尝试将UIAppearance代理样式应用于UILabel类代理时,得到的结果不可靠。例如,以下工作符合我的预期:
[[UILabel appearance] setFont:[UIFont fontWithName:SOME_FONT size:SOME_SIZE]];
[[UILabel appearance] setShadowColor:[UIColor blackColor]];
设置textColor不起作用,但是,这是:
[[UILabel appearance] setColor:[UIColor greenColor]];
确实有效。有点。这有点不可靠,并且会导致setTextColor:
忽略任何特定于实例的调用。
将UIAppearance样式应用于UILabel的正确方法是什么?
好的,事实证明您不能使用UIAppearance
代理设置任何UILabel属性的样式。
尽管UILabel
该类符合UIAppearanceContainer
协议,但对UILabel.h的检查表明,没有UI_APPEARANCE_SELECTOR
使用标记任何属性,这是使用的前提条件UIAppearance
。
臭虫
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句