开发者

UIButton states

I am making multiple custom buttons that look much like this:

UIButton states

It is a simple button with either the green or gray in the "indicator view". What I need some explanation for is: In interfacebuilder there are four states a button can have; Normal, Highlighted, Selected and Disabled. When I provide images for everything except disabled I thought that normal would be when no touches were made on the button, highlighted is while you hold your finger on it and selected would be when after you release finger.

However I do not think thats right now. I use the touch-up-inside event. Is it correct that I need to set the select开发者_Python百科ed/highlighted etc property on the button?

Thank you for your time.


You might want to set to selected and not highlighted. Highlight is darkening the button for a fraction when touching the UIButton. UIButton can modify your image automaticaly so usually you don't need to provide a highlight image.
Disabled is when it is disabled.
Selected is when it is selected. You can invert the select flag on touch up inside event to make a state button.
[button setSelected:![button isSelected]];


Yes, you need to respond to the touch up inside by setting the button to highlighted.

Btw, it's "disabled" not deselected, but it doesn't sound like you need that state.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜