I have AuthViewController
that is presenting MainViewController
like so:
let mainVC = MainViewContoller()
mainVC.modalTransitionStyle = .CrossDissolve
authVC.presentViewController(mainVC, animated: true, completion: nil)
I want the AuthViewController
to hide the status bar, but the MainViewController
to show, like so:
AuthViewController {
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return .LightContent
}
override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation {
return .Fade
}
override func prefersStatusBarHidden() -> Bool {
return false
}
}
MainViewController {
override func preferredStatusBarStyle() -> UIStatusBarStyle {
return .LightContent
}
override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation {
return .Fade
}
override func prefersStatusBarHidden() -> Bool {
return false
}
}
The status bar appears, however the preferredStatusBarUpdateAnimation()
override is ignored. The status bar appears with no animation.
I have only been able to get it to animate by setting prefersStatusBarHidden
on MainViewController
to true
until the viewDidAppear
, then calling this:
UIView.animateWithDuration(0.3) {
self.setNeedsStatusBarAppearanceUpdate()
}
I don't want to have to call this every time. What am I doing wrong?