我正在尝试使用UIAppearance更改应用程序中导航栏的颜色。
但是只有当我使用系统颜色时,它才有效:
UINavigationBar *navigationBarAppearance = [UINavigationBar appearance];
[navigationBarAppearance setBarTintColor:[[UIColor alloc] initWithRed:220.0f green:47.0f blue:40.0f alpha:100.0f]]; // does not work
[navigationBarAppearance setBarTintColor:[UIColor colorWithRed:220.0f green:47.0f blue:40.0f alpha:100.0f]]; // does not work
[navigationBarAppearance setBarTintColor:[UIColor redColor]]; // works
方法
colorWithRed:green:blue:alpha:
0.0
和1.0
之间的四个值。因此,如果您具有从0.0
到255.0
的组件,则需要通过除以255.0f
进行归一化。[UIColor alloc] initWithRed:220.0f/255.0f green:47.0f/255.0f blue:40.0f/255.0f alpha:100.0f/255.0f]
关于ios - UIAppearence仅在iOS中使用系统颜色吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24679041/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |