在尝试将UIAppearance代理样式应用于UILabel类代理时,我得到了不可靠的结果.例如,以下工作正如我所期望的那样:
[[UILabel appearance] setFont:[UIFont fontWithName:SOME_FONT size:SOME_SIZE]];
[[UILabel appearance] setShadowColor:[UIColor blackColor]];
Run Code Online (Sandbox Code Playgroud)
但是,设置textColor不起作用:
[[UILabel appearance] setColor:[UIColor greenColor]];
Run Code Online (Sandbox Code Playgroud)
确实有效.有点.它有点不可靠,导致任何特定于实例的调用setTextColor:被忽略.
将UIAppearance样式应用于UILabel的正确方法是什么?