1

When I set up my app, and run it the status bar doesn't appear. I have a view controller named: "MOVViewController" with .xib file. In the AppDelegate.h I have this:

@property (nonatomic, retain) IBOutlet MOVViewController *viewController_;

In the .m, I have this:

- (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;
}

When I run it, the viewcontroller appears, but there is no status bar. Why? Thank in advance

rmaddy
  • 314,917
  • 42
  • 532
  • 579
user2430463
  • 95
  • 1
  • 7

2 Answers2

0

Try adding this in didFinishLaunchingWithOptions method

[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent
                                            animated:NO];

You can change StatusBarStyle as you please

Edit: Actually, the method to show/hide the status bar is

[[UIApplication sharedApplication] setStatusBarHidden:NO];
Zia
  • 14,622
  • 7
  • 40
  • 59
0

Setting status bar style won't help unless you set statusBarHidden property of the application, like below:

[[UIApplication sharedApplication] setStatusBarHidden:NO];

Also set UIStatusBarHidden key in the Info.plist file to NO.

ismailgulek
  • 1,029
  • 1
  • 11
  • 8
  • I think i found it: you should set your view controller instance `viewController_` as rootViewController for your `_window`. You can do this as `[_window setRootViewController:viewController_]`. – ismailgulek Mar 25 '14 at 08:29