Friday, May 1, 2009

iPhone: Touch, Drag, Hit!

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.

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

4 comments:

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

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

    ~Mandy

    ReplyDelete
  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.

    ReplyDelete
  4. The source code (link) is gone. Please publish (again). Your example is exacly what i'm looking for. thanks.

    ReplyDelete