我正在修改苹果网站上的“MoveMe”示例。当我的控制器获得“touchesMoved”消息时,它将移动的对象移动到触摸的中心,因为(伪代码)object.center = touch.center。我如何存储初始触摸的偏移量,以便如果我开始触摸/拖动到一边时,我的手指将保持在该位置,同时将其拖动?iPhone“touchesBegan”和“touchesMoved”消息...不要移动到触摸中心
0
A
回答
0
当touchBegan消息到达时,您可以将target_view.frame存储在实例变量中。
0
你不能将它存储在你的类的实例变量中吗?
相关问题
- 1. iPhone:泛移动使用touchesBegan,touchesMoved和touchesEnd
- 2. iPhone多点触控 - 一些触摸调度touchesBegan:但不touchesMoved:
- 3. 是否可以从touchesBegan或touchesMoved内部取消触摸?
- 4. 的touchesBegan和touchesMoved卡
- 5. 如何区分touchesBegan和touchesMoved
- 6. Touchesbegan使用touchesmoved时总是会触发?
- 7. touchesbegan,touchesmoved,touchesended问题
- 8. UIButton移动和触摸
- 9. Iphone SDK:移动并旋转触摸
- 10. touchesMoved调用没有touchesBegan
- 11. 触摸在Cocos2d中移动
- 12. 为什么UIEvent在touchesBegan和touchesMoved中有不同的对象?
- 13. touchesBegan后,您可以强制触摸事件取消吗?
- 14. iPhone - 移动物体沿触摸和拖拽路径
- 15. 在移动网络应用上触发滑动和触摸事件? - iPhone/Android
- 16. iPhone SDK UIScrollView在移动后没有得到触摸事件
- 17. 移动画布矩形触摸问题(矩形中心)
- 18. iPhone SDK触摸感动?
- 19. 触摸行动在cocos2d-iphone
- 20. UIViewController没有收到touchesBegan消息
- 21. 移动触摸显示和隐藏div
- 22. 将SKSpriteNode移动到触摸位置
- 23. 平滑移动与触摸
- 24. 移动触摸行为
- 25. C#拍摄移动触摸
- 26. cocos2d触摸移动速度
- 27. Android移动对象触摸
- 28. 为什么touch(set)会在touchesBegan中传递而不是触摸?
- 29. 触摸屏在任何触摸上清除状态消息
- 30. 移动网站不以iPhone为中心
是的,请稍微解释一下。 – DyingCactus 2010-03-13 14:01:50
@DyingCactus:好的,解释好一点:) – Nippysaurus 2010-03-14 23:27:32
Tuomas和Macmade从本质上讲是正确的,如果他们的回答有帮助,你可以upvote或接受。您需要两个CGFloat ivars来存储您在touchesBegan中设置的x和y偏移量,并在touchesMoved方法中使用。 – DyingCactus 2010-03-15 00:51:20