我花了大约一个小时试图弄明白为什么我的BarTintColor没有在UINavigation酒吧中改变。我想您不能使用RGB来设置BarTintColor?有办法解决这个问题吗?我想要能控制颜色。
更新:
好吧坎布拉帮了我很多。我将以下内容放在"applicationdidFinishLaunchingWithOptions“末尾的应用程序代表中
NSUInteger r = 228, g = 228, b = 228;
UIColor *color =
[UIColor colorWithRed:r / 255.0 green:g / 255.0 blue:b / 255.0 alpha:0];
[[UINavigationBar appearance] setBarTintColor:color];
return YES;我确认了代码正在执行。但是我导航条上的色调不改变吗?
发布于 2014-07-07 20:56:41
您必须将RGB值除以255.0,因为UIColor需要0.0-1.0范围内的值:
NSUInteger r = 127, g = 127, b = 127;
UIColor *color = [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0];https://stackoverflow.com/questions/24619578
复制相似问题