[英]How to make a Navigation bar transparent and fade out like in the photo app in the iPhone
i am new to iPhone Programming ...can anybody help me out please.. 我是iPhone编程的新手......有人可以帮我解决..
i want to develop an app like photo app in iPhone.. 我想在iPhone中开发像照片应用程序的应用程序..
How to make the naveigation bar and toolbar transparent and fadeout like in photo app in iPhone 如何在iPhone中的照片应用程序中使naveigation栏和工具栏透明和淡出
Thank u .. 感谢你 ..
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: UINavigationBar
继承自UIView
,因此您可以使用UIView
的动画方法通过将alpha
属性设置为0来淡出它。这应该工作:
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[navigationBar setAlpha:0.0];
[UIView commitAnimations];
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. 对我来说感觉更好,但是如果你已经习惯了阻止并且你在iOS 4.0或更高版本中摇摆,那么你应该这样做。
To make the bar transparent, using setBarStyle:
using the UIBarStyleBlackTranslucent
. 要使条形透明,请使用setBarStyle:
使用UIBarStyleBlackTranslucent
。
To hide the bar with fade animation, use the code snippet Macatomy posted. 要使用淡入淡出动画隐藏栏,请使用已发布的代码段Macatomy。
According to Apple specs, you should never change the frame
, bounds
, or alpha
values of the navigation bar. 根据Apple规范,您不应该更改导航栏的frame
, bounds
或alpha
值。
To hide (or show) the navigation bar, you can change the navigationBarHidden
property or call the setNavigationBarHidden:animated
method. 要隐藏(或显示)导航栏,您可以更改navigationBarHidden
属性或调用setNavigationBarHidden:animated
方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.