0

I'm in the same situation as this problem. For some reason, the status bar still doesn't fade in or out. I've pretty much tried every solution posted on this website.

I'm using a UINavigationController -> UIViewController.

I have View controller-based status bar appearance set to YES. Here's my code:

var statusBarHidden = false

func toggleStatusBarHidden() {
    statusBarHidden = !statusBarHidden
    setNeedsStatusBarAppearanceUpdate()
}

override func prefersStatusBarHidden() {
    return statusBarHidden
}

override func preferredStatusBarUpdateAnimation() {
    return .Fade
}

Any ideas why that might be the case?

Community
  • 1
  • 1
Altinio
  • 21
  • 4

2 Answers2

1

Figured out my problem. I created the function on a view controller bounded by a UIContainerView. I need to move those methods into the parent view controller.

Altinio
  • 21
  • 4
0

Had the same problem as well. I ended up using the following method in viewWillAppear or viewWillDissapear:

 UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .None)

Note: It's deprecated in iOS 9.0, but still usable.

Faiz Mokhtar
  • 938
  • 1
  • 10
  • 24