导航栏上出现白线

时间:2013-12-04 14:25:50

标签: ios uinavigationbar

我正在尝试通过AppDelegate设置导航栏的颜色,并将纯色框设置为背景图像。这是我使用的代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:   (NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent animated:YES];


[[UINavigationBar appearance] setBackgroundImage:
 [UIImage imageNamed:@"Navigation"] forBarMetrics:UIBarMetricsDefault];

NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], NSForegroundColorAttributeName, nil];
[[UINavigationBar appearance] setTitleTextAttributes:attributes];

return YES;
}

令人惊讶的是,我在导航栏的中间有一条白线。请记住,我在另一个应用程序中使用了完全相同的方法,一切正常。这就是它的样子: enter image description here

2 个答案:

答案 0 :(得分:1)

检查您的View Controller是否在NavigationController下。我敢打赌你没有为你的viewController设置navigationController。

BTW,如果要使用白色状态样式,则需要将“基于控制器的状态栏外观”更改为“否”。

答案 1 :(得分:0)

好吧终于意识到出了什么问题。我忘了添加@ 2x照片。因为我在iphone5s上运行我的应用程序,所以它正在调整一张小照片。

相关问题