开发者

Difference between "(NSSet *)touches" and "event.allTouches" in "touchesBegan:withEvent:"

开发者 https://www.devze.com 2023-04-06 20:18 出处:网络
I need to move, rotate and zoom an UIImageView object. In the method..开发者_运维知识库. touchesBegan(NSSet *)touches withEvent:(UIEvent *)event

I need to move, rotate and zoom an UIImageView object. In the method..开发者_运维知识库.

touchesBegan(NSSet *)touches withEvent:(UIEvent *)event

which touches do I have to use?

(NSSet *)touches

or

event.allTouches

In other words, where are my touches?


touches passed as the parameter are the touches in your view.

event.allTouches contains all the touches of the event, even the one that didn't start in your view.

Don't hesitate to read the Event Handling Guide for iOS in Apple's doc, it is explained with some pictures it will probably help you understand better.

Especially the difference between the touches in the parameters and event.allTouches is described here ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消