Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIButton State (UIControlState)

How do I set the state of of UIButton ?

In the UIButton class reference there is a "state" but it is only "readonly".

Thanks James

like image 710
jodm Avatar asked Aug 18 '10 08:08

jodm


2 Answers

You can set selected property for example

buttton.selected = YES;

Also enabled and highlighted properties are available.

Note that all these properties set a bit mask on control's state which you can get using read-only state property.

like image 161
Vladimir Avatar answered Sep 18 '22 01:09

Vladimir


myButton.highlighted = YES/NO;
myButton.selected = YES/NO;
myButton.enabled = YES/NO;

These are defined on UIButton's ancestor UIControl.

like image 24
Felixyz Avatar answered Sep 22 '22 01:09

Felixyz