I’m trying to make a UIImageView accept actions and fire them everytime it clicked on the UIImageVie, but i’m having hard time in getting it to work, please help me out
but here is what i’m doing:
[View setUserInteractionEnabled:YES];
[View addTarget:self action:@selector(myAction:) forControlEvents:UIControlEventTouchUpInside];
- (void) myAction:(id)sender
{
NSLog(@"It works!");
}
Objective-C
In your
viewDidLoad:method write this:Then call your gesture method like this:
Swift