How to get UITouch location from UIGestureRecognizer

后端 未结 4 753
天命终不由人
天命终不由人 2020-12-08 18:44

I want to get the UITouch location of my tap from UIGestureRecognizer, but I can not figure out how to from looking at both the documentation and other SO questions. Can one

4条回答
  •  暖寄归人
    2020-12-08 18:56

    Apple Docs say

    UIGestureRecognizer

    - (NSUInteger)numberOfTouches
    

    The number of UITouch objects in a private array maintained by the receiver.

    So you shouldn't access them.

    Using the value returned by this method in a loop, you can ask for the location of individual touches using the locationOfTouch:inView: method.

提交回复
热议问题