I have multiple UITabBar in my application and some ViewController has White color statusbar and some ViewController has black color statusbar.
My info.plist
View controller-based status bar appearance to YES
My Viewcontroller has below code.
override var preferredStatusBarStyle: UIStatusBarStyle {
return .default //or return . lightContent
}
but preferredStatusBarStyle never getting called.
i have also written below line in my controller viewDidLoad but still above wasn't getting called.
self.setNeedsStatusBarAppearanceUpdate()
also i have changeed controller-based status bar appearance to YES && NO for multiple time to check but nothing helps to me.
I have also tried below solutions and other stackoverflow answers but nothing helps me.
preferredStatusBarStyle not respecting on iOS 13
preferredStatusBarStyle var not working in iOS12?
EDIT
In my current project i have integrated AKSideMenu and AKSideMenuViewController has below code to change the statusBarStyle and it getting called when i move from 1 to another ViewController.
Here is the code of AKSideMenu
public var menuPreferredStatusBarStyle: UIStatusBarStyle = UIStatusBarStyle.lightContent
// MARK: - Status Bar Appearance Management
override open var preferredStatusBarStyle: UIStatusBarStyle {
var statusBarStyle = self.contentViewController?.preferredStatusBarStyle ?? .default
if self.scaleContentView {
if self.contentViewContainer.frame.origin.y > 10 {
statusBarStyle = self.menuPreferredStatusBarStyle
}
} else {
if self.contentViewContainer.frame.origin.x > 10 || self.contentViewContainer.frame.origin.x < -10 {
statusBarStyle = self.menuPreferredStatusBarStyle
}
}
return statusBarStyle
}
When i write the same code in MY controller it wasn't getting called. any help will be appreciated. Thanks
from preferredStatusBarStyle not getting called in iOS 13 and other
No comments:
Post a Comment