UIStatusBar无缘无故地改变了风格 [英] UIStatusBar changes style for no apparent reason
问题描述
我有一个应用程序,我将 UIStatusBarStyle
设置为 UIStatusBarStyleLightContent
,它可以正常工作一段时间。然后,突然之间,它突然变为 UIStatusBarStyleDefault
,没有明显的原因。
I have an app in which I set the UIStatusBarStyle
to UIStatusBarStyleLightContent
and it works perfectly fine for a while. Then, as suddenly than unexpectedly, it changes to UIStatusBarStyleDefault
for no apparent reason.
查看基于控制器的状态栏外观
属性设置为否
。
是否存在我应该在 UIStatusBarStyle
中设置一个特定的地方?目前我在 - (BOOL)应用程序:(UIApplication *)应用程序didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
之前设置它。
Is there a specific place which I should set the UIStatusBarStyle
in? Currently I set it in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
before anything else.
非常感谢您提供任何线索。
Thank you very much for any clues.
推荐答案
您必须设置.plist文件,如:
You have to set .plist file like :
写每个视图控制器:
-(UIStatusBarStyle)preferredStatusBarStyle
{
if [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
return UIStatusBarStyleLightContent;// for black color
}else
{
return UIStatusBarStyleDefault;// set as default
}
}
希望它有所帮助。
快乐编码......
happy coding...
这篇关于UIStatusBar无缘无故地改变了风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!