如何设置电池栏的隐藏和显示

来源:互联网 发布:小游戏软件开发公司 编辑:程序博客网 时间:2024/05/27 09:48

IOS7以后增加了新的方法

// These methods control the attributes of the status bar when this view controller is shown. They can be overridden in view controller subclasses to return the desired status bar attributes.- (UIStatusBarStyle)preferredStatusBarStyle NS_AVAILABLE_IOS(7_0); // Defaults to UIStatusBarStyleDefault- (BOOL)prefersStatusBarHidden NS_AVAILABLE_IOS(7_0); // Defaults to NO// Override to return the type of animation that should be used for status bar changes for this view controller. This currently only affects changes to prefersStatusBarHidden.- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation NS_AVAILABLE_IOS(7_0); 

其中主要是关于statusBar的设置问题。如果我们需要在IOS7以上的版本使用,那么必须咋info.plist增加View controller-based status bar appearance的属性

这个属性是什么意思呢,如果设置为YES,表示StatusBar可以调用以上新增的方法可以设置,如果为No,那么就无法在ViewController内进行设置,智能使用UIApplication的方法进行设置。

一般如果我们要进行IOS6的兼容的话,那么必须设置为No,因为IOS6没有这些方法,如果只要做在IOS7以上版本,那么完全可以设置为YES,然后根据我们的需要实时的去变化StatusBar,记住了吗?

0 0
原创粉丝点击