我正在使用
//declared in viewcontroller.m
#define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
//super view did load
[[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x9ff1d1)];
//above view did load
- (void)viewWillAppear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:NO animated:animated];
[super viewWillAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:NO animated:animated];
[super viewWillDisappear:animated];
}
在我的应用中设置导航栏颜色并且有效。更新到iOS 8后,我认为它必须已被弃用。有没有办法将导航栏颜色设置为十六进制颜色:0x9ff1d1)];