Happy New Year!
I want to hide status bar after calling UIImagePickerController on iOS 10.2. You know there are already several questions about it with some answers, but I'm afraid the answers don't work for Swift 3.0.
The suggested answers are:
- extend UINavigationController to override preferStatusBarHidden, because UIImagePickerController is a subclass of UINavigationController.
So I tried:
extension UINavigationController{
open override var prefersStatusBarHidden: Bool{
return true
}
}
- extend UIImagePickerController to override prefersStatusBarHidden.
So I tried:
extension UIImagePickerController{
open override var prefersStatusBarHidden: Bool{
return true
}
}
- create and use a subclass of UIImagePicker
So I tried:
class MyImagePickerController: UIImagePickerController{
override var prefersStatusBarHidden: Bool{
return true
}
}
But, unfortunately, none of the above solutions seems working for me. I'd like iOS developers who are proficient in Swift 3.0 to let me know how to hide status bar after calling UIImagePickerController.
Thank you for your interest and time!
The status bar can be hidden and show when presenting view controller UIImagePickerController swift 4+
You are adding the delegate method method of
UINavigationControllerDelegate
like below.Adding the delegate and hide the status bar in it.
The status bar can be permanently hidden with the following extension to
UIImagePickerController
:This is working for Swift 3, on iOS 10.