Reputation: 147
I've created a UIView programatically. I've added tap gesture action programatically.
I would like to invoke the tap programatically.
Here's what I've got so far.
MyUIView *myView = [[MyUIView alloc] init];
UITapGestureRecognizer *oneTap =
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSingleTap:)];
[myView.addGestureRecognizer:oneTap];
Now I would like to invoke a tap event on this myView.
How can I do that programatically?
Upvotes: 1
Views: 2278
Reputation: 17409
You have to just call handleSingleTap
method just like you can call other methods,
[self handleSingleTap: oneTap];
Upvotes: 3