I am trying to add a UILongPressGestureRecognizer
to one of the UITextField on the page, but does not invoke the selection method when Long Press UiTextField. I added it to the UItextField. But it does not call the Selector method when I press TextField for a long time, but I display a magnifying glass in the field.
[self.tfCustomerStreet addGestureRecognizer:LongPressgesture]
But it works fine and calls the selection method if I add it to the view.
[[self view] addGestureRecognizer:LongPressgesture];
Initialization Code in ViewDidLoad
UILongPressGestureRecognizer *LongPressgesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(LongPressgesture:)]; [LongPressgesture setMinimumPressDuration:2.0];
.
// Long press gesture reconizer - (void)LongPressgesture:(UILongPressGestureRecognizer *)recognizer { if (recognizer.state == UIGestureRecognizerStateEnded) { NSLog(@"Long press Ended ................."); } else { NSLog(@"Long press detected ....................."); } }
Please tell me how to do this with UITextField.
Azhar source share