views:

53

answers:

1

Hi all,

I found a useful tutorial to get started in understanding how to Cocoa handles touch events. I've used this as a base to create a custom script, I'm trying to make a UIView draggable, very similar to the native Maps application.

  • I've written a custom script, using the touchesBegan method it will capture where the input began and compare it to the centre point of the UIView using some conditional statements.
  • The touchesMoved method will do some further conditional statements to determine whether the touch start point and the center of the view will move positively or negative.
  • I've also captured the views boundaries so it doesn't go too far out.

it's lacking the polished finished found in other applications such as Maps, or scrolling a UITable, such as the ease effect after the user has released their fingers, and the snapping effect when it reaches the boundaries is horrible.

Is there a method that takes a view and makes it draggable like this? If not I'll continue to refine my script.

Many thanks!

A: 

Maybe you are looking for UIScrollView

CiNN
I am indeed, many thank CiNN :)
Chris