设置为半透明时,导航栏变为透明 [英] Navigation bar becomes transparent when set to translucent

查看:116
本文介绍了设置为半透明时,导航栏变为透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用XCode 5.02和iOS7 SDK。

I'm using XCode 5.02 and iOS7 SDK.

我正在尝试将导航栏设置为半透明但是当我这样做时,它们会变得完全透明。状态栏也将是透明的。我可以在导航栏上看到标题和按钮,但没有背景。在我的项目中的所有视图控制器中都会发生相同的情况,因此这不会绑定到特定视图。当我设置半透明= NO时,我得到纯色。

I'm trying to set my navigation bars as translucent but when I do that, they become completely transparent instead. The status bar will also be transparent. I can see the title and buttons on the navigation bar but no background. The same happens in all view controllers in my project, so this is not bound to specific view. When I set translucent = NO, I get solid colors.

这是在模拟器和运行iOS7的设备上。

This is both in the simulator and on a device running iOS7.

我尝试在.plist文件中将半透明设置为ON,并尝试在viewDidLoad和viewWillAppear中直接在这样的代码中设置它:

I have tried setting translucent to ON in the .plist file and also tried setting it directly in code like this in viewDidLoad and viewWillAppear:

self.navigationController.navigationBar.translucent = YES

任何想法都赞赏。

谢谢。

推荐答案

我在设置导航栏时遇到了同样的问题虽然半透明,但当我这样做时,它们变得完全透明而不是

试试这个:
选择在文件检查器中使用Autolayout选项。这也可以解决你的问题。

I had the same problem setting my navigation bars as translucent but when I do that, they become completely transparent instead
Try this: select Use Autolayout option in file inspector.this may solve your problem too.

这篇关于设置为半透明时,导航栏变为透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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