views:

55

answers:

1

imgView is a UIImageView that is added as a subview to a custom UITableViewCell class. The action isn't being called when the image is tapped.

[imgView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openMedia:)]];
+3  A: 

UIImageView ignores user events by default. You need to enable them with:

imgView.userInteractionEnabled = YES;

Beware, you are also leaking your gesture recognizer.

Jason Foreman
:P That was an easy mistake. Thanks for the tip on the leak... forgot to autorelease it
E-Madd