I have a UIPanGestureRecognizer, I can use the locationInView method, but when I type the traslationInView, I can’t use it and the system says:
No visible @interface for UIGestureRecognizer declares the selector 'translationInView'.
All the format should be all right. How is that?
It’s because your reference is of type
UIGestureRecognizerinstead ofUIPanGestureRecognizer.As
UIPanGestureRecognizeris subclass ofUIGestureRecognizerso derived class members are not visible when you use super class refernceEither type cast
UIGestureRecognizerreference toUIPanGestureRecognizerOr simple replace
UIGestureRecognizerwithUIPanGestureRecognizerin your method as