没有NIB,UIWindow不填充屏幕,iOS 7 [英] No NIBs, UIWindow Not Filling Screen, iOS 7
问题描述
我完全避免使用NIB。我在iOS 7.1上遇到问题,但在iOS 8.x上没有。
I'm avoiding using NIBs completely. I'm getting problems on iOS 7.1, but not on iOS 8.x.
iOS 7与iOS 8
代码在 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;
}
我也试过一些处理iOS 8的方法,但即使设置了 UIWindow
frame
到 5000,5000
会产生相同的结果。
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等,则翻转界限等]
[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 problem is that you don't have a launch image for the 4-inch screen, so the iPhone 5s is treating this app as a 3.5-inch app (iPhone 4) and letterboxing it.
这篇关于没有NIB,UIWindow不填充屏幕,iOS 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!