objective c - iOS: UIButton's title color when disabled -


i'm using mac os x el capitan 10.11.2, xcode 7.1.1 , ios 7 deployment target ios application @ hand.

currently, want stylize uibutton, it's text , background (color/image) grayed out/has lowered alpha when disabled. started playing control in .xib editor , started changing text color, background color , button image. also, after each change of aforementioned parameters altering enabled state well. results surprising. if button's title color set default 1 - blue one, disabling button .xib editor in xcode results in grayed out button's title, great - no need manually stylize title in disabled state. awkward behavior takes place when button's title color set value differing default 1 (green let's say) - no grayscaling, lowering alpha component or other visual disabling effect applied.

the result - 1 should manually apply visual disabling in case button's title color differs default one. bad partial behavior. no such thing observed when using uilabel. no matter text color disabled grayed-out kept when label disabled. uibutton behaves expected when given image - image has alpha value set lower value when button disabled. both uibutton , uilabel not alter background color if disabled.

what want use ios automatic disabled ui look, there visual consistency across ui elements when disabled. don't want use the:

uibutton settitlecolor: (uicolor*) color forstate: (uicontrolstate) state;

because don't want manually specify color disabled state rather use automatic ios color, image, etc. alternation in disabled state.

also, specified erroneous behavior above regression, or?

you can't. once call settitlecolor:forstate: on uicontrolstatenormal state, color applies states don't have own specific color.

the documentation uibutton settitlecolor:forstate: makes clear:

in general, if property not specified state, default use uicontrolstatenormal value. if uicontrolstatenormal value not set, property defaults system value. therefore, @ minimum, should set value normal state.

so once set color normal state, need set desired colors other states such disabled state.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -