ios - How can I check if an appearance property has been set? -


is there way check if property has been set on uiappearance proxy or not?

let's want like:

self.linewidth = appearance.linewidth ? : kdefaultlinewidth; 

this not work correctly if linewidth set 0 on proxy since indistinguishable not having been set @ (assuming it's cgfloat).

you shouldn't need make check; appearance system take care of you. in initialiser, set linewidth default value using direct ivar access instead of setter:

_linewidth = kdefaultlinewidth; 

if appearance property has been set linewidth, overridden. if not, not overridden.

the problem arises when instead set linewidth via setter. appearance system mark instance having been customised, , won't override change.

source: http://petersteinberger.com/blog/2013/uiappearance-for-custom-views/

one gotcha uiappearance swizzles setters have default apperance, , tracks when changed, uiappearance doesn’t override customizations. [if] use setters in initializer, ...for uiappearance looks though customized class ourselves. lesson: use direct ivar access in initializer properties comply ui_appearance_selector.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -