Brandon
Brandon

Reputation: 2171

Prevent User from Clicking Button Behind UIImageView

I have a view with several buttons on it. when one of these buttons is clicked, an Image View pops up over all of the other buttons. Even though the image is covering all of the buttons, they are still clickable. Is there a way in XIB to make it so that a user can't click through an Image View? I know I could go in programmatically and disable/enable the buttons one at a time, but I am sure there is a simpler way to do this. Any ideas? Thanks!

One of the recommendations below is that I enable user interaction on the image. However, I am still able to click buttons below the image view. Please see the image as an example.

enter image description here

Upvotes: 1

Views: 1429

Answers (1)

Stavash
Stavash

Reputation: 14304

Mark the UIImageView's userInteractionEnabled property as YES. This way, it will "steal" the touch events away from the underlying UIButton

Upvotes: 8

Related Questions