我的导航栏颜色通常出现在iOS 7中
部署iOS 6.0,但如果系统版本是iOS 7.0或更高版本,某些导航栏着色在iPhone 4上无法正常显示。在iPhone 5中正常工作。
以下是我的表现:
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
self.edgesForExtendedLayout = UIRectEdgeNone;
[self.navigationController.navigationBar setBarTintColor:[UIColor blueColor]];
[self.navigationController.navigationBar setTranslucent:YES];
}
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
也许最后一行是问题(setTranslucent)因为我听说iPhone 4在半透明方面存在一些问题,但我非常确定你可以在iOS 6中将导航栏设置为半透明。将尝试摆脱下一步并更新,如果它修复了任何东西。
编辑: 在我解雇一个呈现的视图控制器后,看起来条形图颜色消失了。但除了iPhone 4之外,它并没有搞砸任何东西。
答案 0 :(得分:4)
摆脱[self.navigationController.navigationBar setTranslucent:YES];它应该工作正常。
如果需要,您可以检查设备型号 (见这里:Determine device (iPhone, iPod Touch) with iPhone SDK)
并相应地调整视图。