Setting a navigationbar to be like the photo app
I am trying to set my navigation bar to be see through like the photos app.
Wh开发者_如何转开发at property is used to achieve this? I have tried the available properties for the navigationbar but I cant get is to work.
IS this possible to do?
I want the View behind the navigationbar to be seen when the bar is over it.
If you are using a .nib you can select the navigation bar and set the navigation bar style to "Black Translucent" in navigation bar attributes (in the inspector).
If you are adding the navigation bar programmatically you can set the style like so in your viewDidLoad:
self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
I imagine you can just set the navigation bar's alpha
property.
From the documentation: "The value of this property is a floating-point number in the range 0.0 to 1.0, where 0.0 represents totally transparent and 1.0 represents totally opaque."
One way is to write your own implementation of -drawRect: method in your navigation bar subclass.
EDIT: A good tutorial: http://atastypixel.com/blog/making-uitoolbar-and-uinavigationbars-background-totally-transparent/
精彩评论