Reputation: 43
I am working on application where i need to call single tap gesture method without touch or swipe anything.I want to call that method when initWithframe method call.I just want to call this method programmatically only once.Please help me.How can i do this?thanking you.
Upvotes: 1
Views: 2199
Reputation: 4726
UISwipeGestureRecognizer *gesture = [[UISwipeGestureRecognizer alloc] init];
gesture.direction = UISwipeGestureRecognizerDirectionLeft;
[self handleSwipe:gesture];
Upvotes: 0
Reputation: 20021
Try this
UITapGestureRecognizer * recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
recognizer.delegate = self;
[view addGestureRecognizer:recognizer];
and the method
- (void)handleTap:(UITapGestureRecognizer *)recognizer {
}
To do it programatically.Why you need to manipulate tap.Just call the method directly.To call method use
[self handleTap:nil];
Upvotes: 2