07-18-2023, 11:30 PM
iOS 7 allows individual view controllers to determine the appearance of the status bar, as described by the Apple developer documentation:
> iOS 7 gives view controllers the ability to adjust the style of the status bar while the app is running. A good way to change the status bar style dynamically is to implement `preferredStatusBarStyle` and—within an animation block—update the status bar appearance and call `setNeedsStatusBarAppearanceUpdate`.
Setting the status bar appearance globally is a two-step process.
First, you need to tell iOS that you don't want to set the status bar appearance on a view-by-view basis.
Then you need to take charge and actually set the new global status bar style.
To disable view-by-view status bar control, you'll need to set the `View controller-based status bar appearance` property in `Info.plist`.
Open the Project Navigator and select the project for your iOS app, then select the Info tab.
Hover over a row, then click the plus sign that appears to add a new property to your `.plist`.
Enter `View controller-based status bar appearance` in the Key field, then make sure the Type field is set to `Boolean`. Finally, enter `NO` in the Value field.
To set a global style for the status bar, add another property under the Info tab with a key of `Status bar style`, a Type of `String` and a Value of `Opaque black style`.
Here's a blog post with a little more detail and some sample code:
> iOS 7 gives view controllers the ability to adjust the style of the status bar while the app is running. A good way to change the status bar style dynamically is to implement `preferredStatusBarStyle` and—within an animation block—update the status bar appearance and call `setNeedsStatusBarAppearanceUpdate`.
Setting the status bar appearance globally is a two-step process.
First, you need to tell iOS that you don't want to set the status bar appearance on a view-by-view basis.
Then you need to take charge and actually set the new global status bar style.
To disable view-by-view status bar control, you'll need to set the `View controller-based status bar appearance` property in `Info.plist`.
Open the Project Navigator and select the project for your iOS app, then select the Info tab.
Hover over a row, then click the plus sign that appears to add a new property to your `.plist`.
Enter `View controller-based status bar appearance` in the Key field, then make sure the Type field is set to `Boolean`. Finally, enter `NO` in the Value field.
To set a global style for the status bar, add another property under the Info tab with a key of `Status bar style`, a Type of `String` and a Value of `Opaque black style`.
Here's a blog post with a little more detail and some sample code:
[To see links please register here]