问题
I am in the process of updating an app for iOS7 (while still supporting iOS6), and have updated the status bar to use a white foreground using UIStatusBarStyle: UIStatusBarStyleLightContent
.
However the UIStatusBarStyleLightContent
value is new in iOS7, and so when run on iOS6 the UIStatusBarStyle
reverts back to UIStatusBarStyleDefault
, giving the light-gray with dark text iOS6 default. But I need my iOS6 version to use the black style UIStatusBarStyleBlackOpaque
status bar.
Given you can set info.plist settings for different device and platform types, e.g. UIStatusBarStyle~ipad
:
https://developer.apple.com/library/ios/DOCUMENTATION/iPhone/conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html
I know I can set the value at runtime via the UIApplication
, but this doesn't have an affect until after the startup image has displayed.
I am hoping you can use a similar mechanism for iOS versions? e.g:
UIStatusBarStyle: UIStatusBarStyleBlackOpaque
UIStatusBarStyle~ios7: UIStatusBarStyleLightContent
However that doesn't work and I can't find any apple documentation anywhere on such a feature. Am I out of luck and will have to live with the ugly white status bar during iOS6 app launches?
EDIT: Just found a similar question here: iOS - Entry in Info.plist for only iOS 6 and above?
Seems like the answer is no, this is not possible. Unless there have been any updates with iOS7?
回答1:
Use this, As i think so, this will be helpful to you,
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
// Load resources for iOS 6.1 or earlier, i.e set status bar here for previous versions
} else {
// Load resources for iOS 7 or later, set status bar here for ios 7
}
来源:https://stackoverflow.com/questions/18998236/ios-version-specific-info-plist-settings