Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios uibutton hidden: does this automatically make the button disabled?

Tags:

I just have a knowledge question about UIButtons / iOS in general.

Let's say you have a UIButton. You set the 'hidden' property to YES. This makes it no longer visible in view, right? But I noticed that while it's no longer visible, it is also no longer clickable either. So, does this mean that setting hidden = YES also sets enabled = NO?

Just curious. Thanks y'all.

like image 730
Nathan Fraenkel Avatar asked Jul 09 '13 13:07

Nathan Fraenkel


1 Answers

UIButton and all controls inherits common properties from UIView like hidden, backgroundColor, etc.

Class reference of UIView says if any view is hidden then it will not receive input events

Class reference of UIView says:

A hidden view disappears from its window and does not receive input events. It remains in its superview’s list of subviews, however, and participates in autoresizing as usual. Hiding a view with subviews has the effect of hiding those subviews and any view descendants they might have. This effect is implicit and does not alter the hidden state of the receiver’s descendants.

you can find this over Here.

like image 57
Nirav Gadhiya Avatar answered Sep 30 '22 11:09

Nirav Gadhiya