简体   繁体   中英

iPhone App - status bar hidden

I want to have the status bar in my iPhone app hidden for the launch image, and then I want to add it after. So in my app delegate, I did the following:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    // Override point for customization after app launch    

    [window addSubview:[navigationController view]];
    [window makeKeyAndVisible];

    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

    return YES;
}

But now, in my main controller, the status bar blocks part of the navigationController at the top of the app. The app thinks the status bar isn't there, or something.

So, how can I have the launch image not include the status bar, but then add the status bar right after, and keep the status bar there for the rest of the app?

In your info.plist file, there's a setting called "Status bar is initially hidden." Set that to "YES," and you won't have it at startup. Then you don't need to do anything in your code, the bar will show up when your app is launched.

   [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM