Reputation: 107
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?
Upvotes: 2
Views: 473
Reputation: 39988
It's because your reference is of type UIGestureRecognizer
instead of UIPanGestureRecognizer
.
As UIPanGestureRecognizer
is subclass of UIGestureRecognizer
so derived class members are not visible when you use super class refernce
Either type cast UIGestureRecognizer
reference to UIPanGestureRecognizer
Or simple replace UIGestureRecognizer
with UIPanGestureRecognizer
in your method as
- (void)yourMethod:(UIGestureRecognizer *)recognizer
{
}
Upvotes: 3