objective c - How are objects made draggable in iphone app? -
I would like to object in my view that could be dragged and dropped.
When they should be dropped into a certain area, they should disappear and execute some code.
How are the objects dragable in an iPhone app? Is this just a button that can be drag enabled?
How will the status of a dragable object be detected? Will it be as simple as Psuedo
if (draggableButton1.xPosition> like & amp; amp; draggableButton1.xPosition & lt; e, g & amp; draggableButton1 YPosition & gt; Like & amp;; & amp; amp;;; DraggableButton1.yPosition & lt; e, g) {Something}
?
When the user touches the object in the method when the following method is called.
- (zero) touches: touches the (NSASE *) event: (UIEvent *) Event went with the touch, the following method Will be called.
- Increased touch (zero) touch: (NSSET *) touches the event: (UIEvent *) Event When the user ends with touch , The following method will be used
- (zero) touch touch: (NSSET *) touches the event: (UIEvent *) Event
In the NSSet
object, there is an UITouch
object that has all the information to touch on the scene, to see which view, position on the screen, the previous position End Tion and so much more you can see the documentation for that.
Start your argument with touch and change the position of your object in touchChanged event. Then when the user drop object, the touched event will be called.
This will help you in three ways ...
Comments
Post a Comment