Kuldeep
Kuldeep

Reputation: 4552

How to change StatusBar Style for LAContext

i have implemented View controller-based status bar appearance to YES in my application.

I have implemeted biometric authentication in my application. but the issue is my UIViewController has .lightContent and when biometric dialog presents for authentication it has .default style so please guide me how can i change the statusBar style of biometric authentication controller.

here is the reference screens.

1. UIViewController with Light Content enter image description here

2. Biometric authentication enter image description here

please guide me how to change biometric authentication statusBar style?

Thanks

Upvotes: 2

Views: 362

Answers (3)

Kishan Bhatiya
Kishan Bhatiya

Reputation: 2368

Try to add this method in ViewController and you may need to set myViewController.modalPresentationCapturesStatusBarAppearance = true on the view controller to be presented modally.

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    self.setNeedsStatusBarAppearanceUpdate()
}
override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent
}

Upvotes: 0

Chetan Hedamba
Chetan Hedamba

Reputation: 291

you can manually change status bar style when biometric authentication controller open

 UIApplication.shared.statusBarStyle = .lightContent

or

  UIApplication.shared.statusBarStyle = .default

Upvotes: 0

user12688502
user12688502

Reputation:

Override this method on the ViewController:

override var preferredStatusBarStyle: UIStatusBarStyle {
    return .lightContent
}

Upvotes: 0

Related Questions