简体   繁体   中英

No NIBs, UIWindow Not Filling Screen, iOS 7

I'm avoiding using NIBs completely. I'm getting problems on iOS 7.1, but not on iOS 8.x.

iOS 7 vs. iOS 8

IOS 7iOS 8

The code looks like this in the UIResponder <UIApplicationDelegate>

- (void) setupViewController {
    CGRect frame = UIScreen.mainScreen.bounds;
    self.window = [[UIWindow alloc] initWithFrame:frame];
    self.window.backgroundColor = UIColor.whiteColor; // viewController's view is green
    ViewController *viewController = [[ViewController alloc] init];
    UIView *view = [[UIView alloc] initWithFrame:self.window.bounds];
    viewController.view = view;
    self.window.rootViewController = viewController;
    [self.window makeKeyAndVisible];
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self setupViewController];
    return YES;
}

I've also tried some methods dealing with iOS 8, but even settings the UIWindow frame to 5000, 5000 produces the same results.

[I've seen a number of related questions and tried out the suggestions, but to no avail, including flipping the bounds if it's iOS 8, etc. etc.]

问题是你没有4英寸屏幕的启动图像,所以iPhone 5s将这个应用程序视为一个3.5英寸的应用程序(iPhone 4)和letterboxing它。

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