简体   繁体   English

如何使导航栏像iPhone中的照片应用程序一样透明和淡出

[英]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规范,您不应该更改导航栏的frameboundsalpha值。

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.

相关问题 iPhone Facebook应用程序如何使导航栏固定 - how iphone facebook app make the navigation bar fixed 如何使照片应用程序中的状态,选项卡和导航栏动画 - how to make status, tab and navigation bar animate like in the photos app 在iphone app / ios中,如何制作一个覆盖导航栏和键盘的透明“加载”覆盖图? - In an iphone app/ios, how to make a transparent 'loading' overlay that covers the nav bar and keyboard? 使用UIImageView制作类似iPhone的Photo Galerry的应用 - Using UIImageView to make a app like iPhone's Photo Galerry 如何使导航栏像Pulse中的导航栏? - How to make the navigation bar like the one in Pulse? 如何使tableview的内容显示在透明导航栏下? - How to make tableview's content displayed under a transparent navigation bar? iPhone:如何通过iPhone照片应用程序等“编辑”功能从照片库或相机中获取图像 - iPhone:How to fetch image from photo library or camera with “edit” funcitionality like iPhone photo app 如何像iPhone的照片应用程序一样实现删除动画 - How to implement delete animation like iPhone's photo app 如何使iPhone应用程序上的导航栏看起来像金属的? - How can I make the navigation bar on my iPhone app look metallic? 如何在导航栏中显示进度条,例如在iPhone中的消息应用程序中? - how to show progressbar in navigation bar like in messages application in iphone?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM