iOS 7 status bar back to iOS 6 default style in iPhone app?

前端 未结 25 1197
终归单人心
终归单人心 2020-11-22 05:48

In iOS 7 the UIStatusBar has been designed in a way that it merges with the view like this:

\"GUI

25条回答
  •  余生分开走
    2020-11-22 06:21

    My very simple solution (assuming you have only vertical orientation supported) is to redefine application window bounds for iOS versions below 7, in App delegate didFinishLaunchingWithOptions method:

    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    if ([HMService getIOSVersion] < 7) {
        // handling statusBar (iOS6) by leaving top 20px for statusbar.
        screenBounds.origin.y = 20;
        self.window = [[UIWindow alloc] initWithFrame:screenBounds];
    }
    else {
        self.window = [[UIWindow alloc] initWithFrame:screenBounds];
    }
    

提交回复
热议问题