Reputation: 2625
Am developing an iPhone App. When the user taps a button, displaying a semi-transparent UIImageView on a page (i.e. covering the whole page). Now, since the UIImageView is semi-transparent, the buttons beneath it are seen. Clicking on the buttons (though the UIImageView is on top of it) is causing the button-click to be processed ; but I want to stop this. When the UIImageView is on th e top, only touching UIImageView (which calls a method) should work ; touching anything beneath it shouldn't.
Upvotes: 2
Views: 617
Reputation: 344
It would be better if you will add your semi-transparent imageView not to self.view but to your application's window. like this:
AppDelegate *delegate = (Appdelegate *)[[UIApplication sharedApplication] delegate];
[delegate.window addSubview:yourImageView];
To remove yourImageView just use
[yourImageView removeFromSuperView];
Upvotes: 0
Reputation: 751
You can add a UIView on the click of a button and then add UIImageview as a subview of view. Then decrease the alpha of uiview.
Upvotes: 0
Reputation: 1838
You have following alternatives : First make sure that UIImageView is on top of button. Bring if front by using bringSubviewToFront
Upvotes: 1
Reputation: 2807
Suppose yourImageView is your UIImageView above your button, do this,
[yourImageView setUserInteractionEnabled:YES];
Upvotes: 2
Reputation: 489
Hide and disable the buttons when the ImageView is shown:
[button setEnabled:NO]; // If you want the button not to respond
[button setHidden:YES]; // If you want the button not to be seen
Upvotes: -1