I want to add capability for the user to change the System Status bar style from Light
to Dark
.
On app launch the style is Light
.
I have added the following code on button click:
//on button click
[self setNeedsStatusBarAppearanceUpdate];
- (UIStatusBarStyle)preferredStatusBarStyle
{
if(darkMode) {
return UIStatusBarStyleDefault;
} else {
return UIStatusBarStyleLightContent;
}
}
But the prefferredStatusBarStyle
method is never called and no change to the status bar occurs.