【发布时间】:2014-03-20 20:21:16
【问题描述】:
在我的 App Delegate 中,我有以下代码,但它在导航栏上方保持完全黑暗,您看不到任何东西。如果我删除导航栏的背景图像,它会正确地将其显示为浅色内容,但我不确定当它出现时会被什么阻挡。 UINavigationBar 的背景图片为 320x44。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
UIImage *theBackground = [[UIImage imageNamed:@"navbar.png"]resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];;
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier
// UIColor *purple = UIColorFromRGB(0x95cdde);
[[UINavigationBar appearance] setBackgroundImage:theBackground forBarMetrics:UIBarMetricsDefault];
} else {
// Load resources for iOS 7 or later
// UIColor *purple = UIColorFromRGB(0x95cdde);
[[UINavigationBar appearance] setBackgroundImage:theBackground forBarMetrics:UIBarMetricsDefault];
}
window.rootViewController = tabBarController;
[window makeKeyAndVisible];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
return YES;
}
这是导航栏图片
【问题讨论】:
标签: ios uinavigationbar uiappearance uistatusbar