iPhone: Touch, Drag, Hit!

May 1, 2009 Matteo Bertozzi | Filed Under Mac OS X, iPhone | 3 Comments

Yesterday, Fredrik has asked me something like “Drag & Drop with Hit Test” on the iPhone. Here’s a simple example.  There’s a simple UIView class that handles the touch events and a protocol that says that if the “DragMe View” has hit or not the “HitMe View”. Below you can see the result and the Source Code Link.

iPhone Touch Drag Hit

The source code is available here: Touch, Drag, Hit Source Code.

3 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Ah, er, um. This might interest you: http://github.com/millenomi/muikit/blob/4a134d43ac937bd8e08e64e9877930b5a394193c/L0DraggableView.h — BSD licensed. (And contributions/forks welcome.)

    Comment by millenomi — May 1, 2009 #

  2. If I wanted this to activate a button instead of a label , how would I do that?? Thanks any help is appreciated!!

    ~Mandy

    Comment by Miranda — August 13, 2009 #

  3. Hey how it the hitDelegate connected to the view? has it been connected using the interface builder. I tried implementing the protocol similar to your definition but I see no effect on my UI.

    Comment by ps — October 20, 2009 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>