Statusbar style on state restoration

89 Views Asked by At

Is there any way to reset statusbar style during the app launch to the one that was used when the app state was preserved (saved)?

1

There are 1 best solutions below

2
On

You can use NSUserDefaults to store a UIStatusBarStyle which is a typedef for int. When you are about to quit the application, store the current status bar style in NSUserDefaults.

[[NSUserDefaults standardUserDefaults setInteger:<my status bar style> forKey:@"style"];
// can use things like UIStatusBarStyleLightContent for <my status bar style>

Then when you want to retrieve this you can do the following.

UIStatusBarStyle style = [[NSUserDefaults standardUserDefaults] valueForKey:@"style"];