简体   繁体   English

没有NIB,UIWindow不填充屏幕,iOS 7

[英]No NIBs, UIWindow Not Filling Screen, iOS 7

I'm avoiding using NIBs completely. 我完全避免使用NIB。 I'm getting problems on iOS 7.1, but not on iOS 8.x. 我在iOS 7.1上遇到了问题,但在iOS 8.x上却没有。

iOS 7 vs. iOS 8 iOS 7与iOS 8

IOS 7iOS 8

The code looks like this in the UIResponder <UIApplicationDelegate> 代码在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. 我也尝试了一些方法处理的iOS 8,但即使是设置了UIWindow frame ,以5000, 5000产生相同的结果。

[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.] [我已经看到了一些相关的问题,并尝试了这些建议,但无济于事,包括如果它是iOS 8等翻转界限等]

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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