getting touches in UIResponder API

2019-08-14 17:39发布

So, UIResponder has methods like:

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

My question is, what's the difference between the touches parameter, and [event allTouches]?

1条回答
我只想做你的唯一
2楼-- · 2019-08-14 18:24

All sets of touches are stored within event.

However, for convenience Apple separately provides the touch that triggered the touchesBegan method to be invoked as a parameter.

If you searched through [event allTouches] and compared them to the UITouch within [touches anyObject], you would find a match.

查看更多
登录 后发表回答