我正在尝试在App委托中以编程方式创建窗口,但状态栏隐藏。在info.plist中,它未设置为YES。该应用程序完美地以这种方式工作,但我也需要显示状态栏。 我在AppDelegate.h中有window和navigationController属性 这是我的didFinishLaunch
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//even when I used customized CGRect and used it initWithFrame, there is no status bar
self.navigationController = [[IEENavigationController alloc] init];
XYZViewController *homeViewController = [[XYZViewController alloc] initWithNibName:@"XYZViewController" bundle:nil];
[navigationController pushViewController:homeViewController animated:YES];
self.window.rootViewController = self.navigationController;
[window addSubview:navigationController.view];
[self.window makeKeyAndVisible];
return YES;
提前谢谢
答案 0 :(得分:0)
您可以在info.plist中添加:
UIViewControllerBasedStatusBarAppearance - YES
然后在要隐藏状态栏的视图控制器中添加此方法。
-(BOOL)prefersStatusBarHidden { return YES; }