Navigation bar becomes transparent when set to translucent

自闭症网瘾萝莉.ら 提交于 2019-12-20 02:54:58

问题


I'm using XCode 5.02 and iOS7 SDK.

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.

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

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

Any ideas appreciated.

Thank you.


回答1:


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.




回答2:


Did you try the option to select Translucent Navigation Bar in the Attributes inspector ?

with your View Controller selected, click on Attributes inspector and from there, you may select the respective type of Top Bar that suits you from a drop down list.

here is a screenshot:



来源:https://stackoverflow.com/questions/21181499/navigation-bar-becomes-transparent-when-set-to-translucent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!