In the following code, I pressed a button in the gesture recognizer:
UILongPressGestureRecognizer *longPress=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(addLongpressGesture:)]; [longPress setDelegate:self]; [BUTTON addGestureRecognizer:longPress];
Here is my addLongpressGesture method:
- (void)addLongpressGesture:(UILongPressGestureRecognizer *)sender { UIView *view = sender.view; CGPoint point = [sender locationInView:view.superview]; if (sender.state == UIGestureRecognizerStateBegan){
using this sender.view code I get the attached view as a UIView But I want the view to be attached (UIButton), how do I get the UIView as UIButton?
source share