问题描述
我正在更新iOS7的应用程序(同时仍支持iOS6),并使用 UIStatusBarStyle:UIStatusBarStyleLightContent
更新状态栏以使用白色前景。
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
.
然而 UIStatusBarStyleLightContent
值在iOS7中是新的,因此在iOS6上运行 UIStatusBarStyle
恢复为 UIStatusBarStyleDefault
,使用浅灰色文本iOS6默认为浅灰色。但我需要我的iOS6版本使用黑色样式 UIStatusBarStyleBlackOpaque
状态栏。
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.
鉴于你可以设置info.plist不同设备和平台类型的设置,例如 UIStatusBarStyle~ipad
:
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
我知道我可以通过 UIApplication
在运行时设置该值,但在启动图像显示之后才会产生影响。
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.
我希望你能为iOS版本使用类似的机制吗?例如:
I am hoping you can use a similar mechanism for iOS versions? e.g:
UIStatusBarStyle: UIStatusBarStyleBlackOpaque
UIStatusBarStyle~ios7: UIStatusBarStyleLightContent
然而,这不起作用,我无法在这样的功能上找到任何苹果文档。我不幸运,在iOS6应用程序发布期间将不得不忍受丑陋的白色状态栏吗?
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?
编辑:刚刚在这里找到了类似的问题:
Just found a similar question here: iOS - Entry in Info.plist for only iOS 6 and above?
似乎答案是否定的,这是不可能的。除非iOS7有任何更新?
Seems like the answer is no, this is not possible. Unless there have been any updates with iOS7?
推荐答案
使用此功能,我认为如此,这将对您有所帮助,
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
}
这篇关于iOS版本特定的info.plist设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!