开发者

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


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.


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

These are defined on UIButton's ancestor UIControl.


The above 2 replies are quite the answers.

It is to be noted that you cannot change state of a UIButton directly. The state is changed indirectly by other event triggers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜