IOS 4.3 永久隐藏状态栏
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5709123/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IOS 4.3 hide status bar permanently
提问by user346443
I'm trying to hide the status bar in iOS 4.3 now that setStatusBarHidden:animated:is deprecated:
我正在尝试隐藏 iOS 4.3 中的状态栏,因为setStatusBarHidden:animated:它已被弃用:
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]; //deprecated
The only option that exists in the plist file is: Status bar is initially hidden. Which only hides the status bar at the start of the app.
plist 文件中存在的唯一选项是: 状态栏最初是隐藏的。这只会在应用程序开始时隐藏状态栏。
Cheers
干杯
回答by crimi
Try this:
尝试这个:
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
From Apple Class Reference:
来自 Apple 类参考:
setStatusBarHidden:withAnimation:
Hides or shows the status bar, optionally animating the transition. - (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation Parameters
hidden YES to hide the status bar, NO to show the status bar.
animation A constant that indicates whether there should be an animation and, if one is requested, whether it should fade the status bar in or out or whether it should slide the status bar in or out.
setStatusBarHidden:withAnimation:
隐藏或显示状态栏,可选择动画过渡。- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation 参数
hidden YES 隐藏状态栏,NO 显示状态栏。
动画 一个常量,指示是否应该有动画,如果需要动画,它是否应该淡入或淡出状态栏,或者是否应该将状态栏滑入或滑出。
回答by Till
But how about [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
但是怎么样 [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
See the UIApplication reference.
请参阅UIApplication 参考。
回答by NWCoder
The new method is:
新方法是:
- (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation
Works the same except the animation type is an enum now to support various animation types.
除了动画类型现在是一个枚举以支持各种动画类型之外,工作原理相同。
回答by Ashar
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
回答by sobstel
seStatusBarHiddenseems to be deprecated and not working anymore.
seStatusBarHidden似乎已弃用,不再工作。
Use prefersStatusBarHiddenon your view controller instead
prefersStatusBarHidden改为在您的视图控制器上使用
- (BOOL)prefersStatusBarHidden
{
return YES;
}

