原创Blog,转载请注明出处
http://blog.youkuaiyun.com/hello_hwc?viewmode=list
我的stackoveflow

源自自己的一个StackOverflow答案
http://stackoverflow.com/a/32808743/3940672
解决办法
使用preferredStatusBarUpdateAnimation
GIf
代码
class ViewController: UIViewController {
var isHidden:Bool = false
@IBAction func clicked(sender: AnyObject) {
isHidden = !isHidden
UIView.animateWithDuration(0.5) { () -> Void in
self.setNeedsStatusBarAppearanceUpdate()
}
}
override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation {
return UIStatusBarAnimation.Slide
}
override func prefersStatusBarHidden() -> Bool {
return isHidden
}
}
本文介绍了在iOS 9中setStatusBarHidden(_:withAnimation:)方法被弃用的解决方案,提供了一种新的处理状态栏隐藏动画的方法,并引用了StackOverflow上的相关回答。
1万+

被折叠的 条评论
为什么被折叠?



