How to make a Navigation bar transparent and fade out like in the photo app in the iPhone
Asked Answered
A

4

8

i am new to iPhone Programming ...can anybody help me out please..

i want to develop an app like photo app in iPhone..

How to make the naveigation bar and toolbar transparent and fadeout like in photo app in iPhone

Thank u ..

Agostino answered 23/6, 2010 at 22:30 Comment(0)
V
22

UINavigationBar inherits from UIView, so you can use UIView's animation methods to fade it out by setting the alpha property to 0. This should work:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[navigationBar setAlpha:0.0];
[UIView commitAnimations];
Ventris answered 23/6, 2010 at 22:37 Comment(0)
R
12

Since I'm a block-using kinda guy, I use this little snippet.

[UIView animateWithDuration:0.5 animations:^{
    [navigationBar setAlpha:0.0];
}];

Feels nicer to me, but you should probably only do this if you're used to blocks and you're rockin' iOS 4.0 or later.

Relique answered 18/7, 2012 at 20:40 Comment(0)
P
6

To make the bar transparent, using setBarStyle: using the UIBarStyleBlackTranslucent.

To hide the bar with fade animation, use the code snippet Macatomy posted.

Phylogeny answered 23/6, 2010 at 22:41 Comment(0)
M
0

According to Apple specs, you should never change the frame, bounds, or alpha values of the navigation bar.

To hide (or show) the navigation bar, you can change the navigationBarHidden property or call the setNavigationBarHidden:animated method.

Misreckon answered 7/8, 2013 at 22:47 Comment(1)
Unfortunately, using -[UINavigationController setNavigationBarHidden:animated:] always performs slide-out effect instead of the fade-out effect that the OP requested.Enos

© 2022 - 2024 — McMap. All rights reserved.