uiimageview
How to detect touches on UIImageView of UITableViewCell object in the UITableViewCellStyleSubtitle style
In your cellForRowAtIndexPath method add this code cell.imageView.userInteractionEnabled = YES; cell.imageView.tag = indexPath.row; UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(myFunction:)]; tapped.numberOfTapsRequired = 1; [cell.imageView addGestureRecognizer:tapped]; [tapped release]; And then to check which imageView was clicked, check the flag in selector method -(void)myFunction :(id) sender { UITapGestureRecognizer *gesture = (UITapGestureRecognizer *) sender; NSLog(@”Tag = %d”, gesture.view.tag); … Read more
Is there an way to make an invisible UIButton that will still “be there” and catch touch events for my UIImageView?
You should be able to set the button’s ‘Type’ to Custom in Interface Builder, and it will not display any text or graphical elements over the UIImageView. This way, you don’t need to adjust the alpha. If the view is built from code, use: button = [UIButton buttonWithType:UIButtonTypeCustom];
Adding image to navigation bar
In your case, this solution found in another answer would work well. With the “CustomImage” category added to UINavigationBar, you can then just call: UINavigationBar *navBar = self.navigationController.navigationBar; UIImage *image = [UIImage imageNamed:@”yourNavBarBackground.png”]; [navBar setBackgroundImage:image]; This code should go in the method – (void)viewWillAppear:(BOOL)animated of the view controller where you want to have the custom … Read more
tap gesture not recognized on uiimageview
Try setting setUserInteractionEnabled:YES before adding gesture recognizer. [imageview1 setUserInteractionEnabled:YES] [imageview2 setUserInteractionEnabled:YES] [imageview1 addGestureRecognizer:singleTap]; [imageview2 addGestureRecognizer:singleTap1]; Update: After the comment you have made I suggest you bring your views to the top before detecting the tap event. Because parent imageView is above and catches these taps. [yourparentview bringSubviewToFront:imageview1]; [yourparentview bringSubviewToFront:imageview2];