Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make UIImagePickerController StatusBar lightContent style?

enter image description here

When I present the ImagePickerController the statusBar text color is still black, how to make like this?

like image 836
folse Avatar asked Jan 20 '14 03:01

folse


2 Answers

In Swift and iOS 9, setStatusBarStyle is deprecated. You could subclass the controller.

private final class LightStatusImagePickerController: UIImagePickerController {
    override func preferredStatusBarStyle() -> UIStatusBarStyle {
        return .lightContent
    }
}
like image 145
Huy Le Avatar answered Nov 05 '22 22:11

Huy Le


Using the answers above the following worked for me:

Implement UINavigationControllerDelegate, UIImagePickerControllerDelegate to your UIViewController and set

imagePickerController.delegate = self;

Add the following method:

-(void) navigationController: (UINavigationController *) navigationController willShowViewController: (UIViewController *) viewController animated: (BOOL) animated { 
    navigationController.navigationBar.barStyle = UIBarStyleBlack;
}
like image 29
Theunodebruin Avatar answered Nov 05 '22 22:11

Theunodebruin