I am developing an application where I have multiple controls on view but I want to enable them when user double tap the view
You can take the example of double click but in device I want to catch the event when their is double tap.
You need to add an UITapGestureRecognizer
to the view which you want to be tapped.
Like this:
- (void)viewDidLoad { [super viewDidLoad]; UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)]; tapGesture.numberOfTapsRequired = 2; [self.view addGestureRecognizer:tapGesture]; [tapGesture release]; } - (void)handleTapGesture:(UITapGestureRecognizer *)sender { if (sender.state == UIGestureRecognizerStateRecognized) { // handling code } }
Add a UITapGestureRecognizer
to the view, with numberOfTapsRequired = 2
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With