iPhone “touchesBegan” and “touchesMoved” message …

2019-08-29 11:46发布

I am modifying the "MoveMe" example from the apple web site. When my controller gets the "touchesMoved" message it moves the object being moved to the centre of the touch, because (pseudocode) object.center = touch.center. How can I store the offset of the initial touch so that if I start the touch/drag to the side my finger will stay on that spot while I drag it around?

2条回答
乱世女痞
2楼-- · 2019-08-29 12:24

Can't you store that in an instance variable of your class?

查看更多
Emotional °昔
3楼-- · 2019-08-29 12:27

You can store target_view.frame in an instance variable when touchBegan message arrives.

查看更多
登录 后发表回答