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

浪子不回头ぞ 提交于 2019-12-03 07:44:09

问题


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 ..


回答1:


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];



回答2:


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.




回答3:


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

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




回答4:


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.



来源:https://stackoverflow.com/questions/3106025/how-to-make-a-navigation-bar-transparent-and-fade-out-like-in-the-photo-app-in-t

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