iPhone:UITabBarController 内的半透明导航栏
这里是。 我在 UITabBarController 中有一个 UINavigationController 。 有没有办法设置导航栏半透明? 我尝试以编程方式将其设置为这样:
navigationController.navigationBar.translucent = YES;
但没有任何变化。 我什至尝试记录半透明值,它实际上是“是”,但条形仍然完全不透明。 导航栏后面的视图覆盖全屏,我什至可以在(半透明)状态栏下看到它。我真的不明白。 仅当导航控制器位于选项卡栏控制器内部时,所有这一切都会发生。
编辑: 你猜怎么着?这是 xcode 搞砸了我的 nib 文件...... 我从头开始重新创建了 xib,它按预期工作。 无论如何,谢谢
Here it is.
I have a UINavigationController inside a UITabBarController.
Is there a way to set the navigation bar translucent??
I tried, programmatically, to set it like this:
navigationController.navigationBar.translucent = YES;
but nothing changes.
I even tried to log the translucent value and it is actually YES but the bar is still completely opaque.
The view behind the nav bar covers the full screen, i can even see it under the (translucent) status bar. I really don't understand.
All this happens only if the nav controller is inside the tabbar controller.
EDIT:
Guess what? It was xcode screwing up my nib file ...
I recreated the xib from scratch and it works as expected.
Thanks anyway
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您设置了错误的属性:
You are setting the wrong property:
我最近还尝试使用 XCode 4.2.1 更改基于 UITabBarController 的应用程序的导航栏样式。 Zebs 给出的代码在这种情况下是错误的。如果您使用自己创建的navigationController,那就没问题,但问题是,由UITabBarController创建的navigationController是由UITabBarController创建的,因此正确的代码是:
注意我们使用moreNavigationController 而不仅仅是navigationController。希望对遇到同样问题的每个人都有帮助。
I am also trying to change navigation bar style for my UITabBarController based app recently using XCode 4.2.1. The code given by Zebs is wrong in this context. If you are working with navigationController that you create by yourself, then it'd be ok, but the thing is, the navigationController created by the UITabBarController is created by UITabBarController hence the correct code is:
Note we use moreNavigationController instead of just navigationController. Hope that helps everyone who is facing the same problem.