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

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值