Skip to content

Instantly share code, notes, and snippets.

@longvudai
Created December 4, 2018 19:42
Show Gist options
  • Save longvudai/68617e77c2d0f0427b2aa238f2880a20 to your computer and use it in GitHub Desktop.
Save longvudai/68617e77c2d0f0427b2aa238f2880a20 to your computer and use it in GitHub Desktop.
set preferredStatusBarStyle when view controller is presented
// in myViewController
class MyViewController: UIViewController {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
override func awakeFromNib() {
super.awakeFromNib()
modalPresentationCapturesStatusBarAppearance = true //allow this VC to control the status bar appearance
modalPresentationStyle = .overFullScreen //dont dismiss the presenting view controller when presented
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment