Reputation: 403
I have a see through UIView
in front of a UIButton
. There are some other UIView
s on the transparent UIView
that the user can interact with.
How do I prevent the user from being able to click the button in the background?
I have tried to assign first responder status to the transparent UIView
, but that doesn't work and doesn't make any sense because how would the user interact with the other visible UIView
s on top?
Upvotes: 0
Views: 96
Reputation: 1
Objective -C
self.buttonName.isEnabled = YES; //button is Enabled self.buttonName.isEnabled = NO; // button is Disabled
Upvotes: 0
Reputation: 4141
just set [self.myButton setEnabled:NO];
when your transparent view is open. Enable the button when you want to allow click
self.navigationItem.rightBarButtonItem.enabled = NO;
swift version
button.isEnabled = false
for navigation bar button
self.navigationItem.rightBarButtonItem?.enabled = false
Upvotes: 1