当我设置我的应用程序并运行它时,状态栏不会出现。我有一个名为:“MOVViewController”的视图控制器,带有.xib文件。在AppDelegate.h中我有这个:
@property (nonatomic, retain) IBOutlet MOVViewController *viewController_;
在.m中,我有这个:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
CGRect rcScreen = [[UIScreen mainScreen] applicationFrame];
_window = [[UIWindow alloc] initWithFrame:rcScreen];
viewController_ = [[MOVViewController alloc] init];
[_window addSubview:viewController_.view];
[self.window makeKeyAndVisible];
return YES;
}
当我运行它时,会出现viewcontroller,但没有状态栏。为什么? 提前谢谢
答案 0 :(得分:0)
尝试在didFinishLaunchingWithOptions方法中添加此方法
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent
animated:NO];
您可以随意更改StatusBarStyle
编辑:实际上,显示/隐藏状态栏的方法是
[[UIApplication sharedApplication] setStatusBarHidden:NO];
答案 1 :(得分:0)
设置状态栏样式不会有帮助,除非您设置应用程序的statusBarHidden
属性,如下所示:
[[UIApplication sharedApplication] setStatusBarHidden:NO];
同时将UIStatusBarHidden
文件中的Info.plist
密钥设置为NO
。