In swift, how do I hide a UIButton?
Here's what I tried:
button.enabled = false
However, that just greys out the button, not making it invisible.
Is there a way to do it in swift? If so, how?
Thanks!
In swift, how do I hide a UIButton?
Here's what I tried:
button.enabled = false
However, that just greys out the button, not making it invisible.
Is there a way to do it in swift? If so, how?
Thanks!
Umm… button.hidden = true
. See UIView Class Reference.
Be sure to look at methods available in parent classes when reading the documentation for a class.
NOTE: A later version of swift enforced button.isHidden = true
as the only option.
I don't know if this is related to your issue but just a tip for others:
If this is for the initial setup:
Make sure that you hide the button within the function ViewWillAppear(animated: Bool)
override func ViewWillAppear(animated: Bool) {
button.hidden = true
}