iOS 7 UINavigationBar背景图像隐藏标题视图 [英] iOS 7 UINavigationBar Background image hides Title view

查看:120
本文介绍了iOS 7 UINavigationBar背景图像隐藏标题视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我制作了iOS应用程序,其中我希望我的应用程序与iOS 7兼容

I made iOS app, in which i want my app to compatible with iOS 7

我面临的问题是,当我在iOS 7上运行我的应用程序时,我的 UINavigationBar 的背景图片隐藏了我的 titleview 后退按钮

Problem which i am facing is, when i run my app on iOS 7, Background image of my UINavigationBar hides my titleview and back button

-(void)viewDidLoad
{
    [super viewDidLoad];

    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"top.png"] forBarMetrics:UIBarMetricsDefault];

    self.title=@"Artist";
    self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil];


}

当我设置背景图片时 UINavigationBar 为零,显示 titleview 后退按钮

also when, i set Background image of UINavigationBar to nil it shows titleview and back button

当我在iOS 7之前运行我的应用程序时,它可以正常工作。

When i run my apps prior to iOS 7 it works properly.

请帮忙。
提前致谢。

推荐答案

的行为tintColor for iOS已在iOS 7.0上更改,请查看下图:

Behavior of tintColor for bars has changed on iOS 7.0, please check the image below:

您可以看到

tintColor :是导航栏中交互元素的颜色,包括按钮图像和标题。

tintColor: is the color for the interactive elements within a navigation bar including button images and titles.

barTintColor UINavigationBar 的背景颜色。

针对您的问题:你可以这样做:

For your issue: you can do the below:

navigationBar.tintColor = [UIColor whiteColor];
navigationBar.barTintColor = [UIColor colorWithRed:6.0/255.0 green:12.0/255.0 blue:19.0/255.0 alpha:1.0];

这篇关于iOS 7 UINavigationBar背景图像隐藏标题视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆