I want to disable a button (UIButton
) on iOS after it is clicked. I am new to developing for iOS but I think the equivalent code on objective - C is this:
button.enabled = NO;
But I couldn't do that on swift.
The disabled attribute is a boolean attribute. When present, it specifies that the button should be disabled. A disabled button is unusable and un-clickable. The disabled attribute can be set to keep a user from clicking on the button until some other condition has been met (like selecting a checkbox, etc.).
Pure CSS Disabled Button is used to create a disabled button. To make the disabled button, we will use the Pure CSS class “pure-button-disabled” with the class “pure-button”. We can also create a disabled button using disabled attribute.
Here's all you need to do to remove the Apps button. First, open the Chrome Browser on your Windows, Mac, or Linux computer. Next, right-click anywhere on the Bookmarks Bar or the “Apps” button itself. This will open a menu, from which you should unselect “Show Apps Shortcut.”
The boolean value for NO
in Swift is false
.
button.isEnabled = false
should do it.
Here is the Swift documentation for UIControl
's isEnabled
property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With