ios 9 objective-c屏幕尺寸问题

我升级到ios 9和xcode 7(来自xcode 6.2),现在,当我启动我的应用程序时,会发生这种情况:

在这里输入图像说明

现在上面和下面都有这些黑条。

我的appDelegate是这样的:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. // self.window.backgroundColor = [UIColor whiteColor]; // [self.window makeKeyAndVisible]; _startViewController = [[StartViewController alloc] init]; _startNavigationController = [[StartNavigationController alloc] initWithRootViewController:_startViewController]; self.window.rootViewController = _startNavigationController; [self.window makeKeyAndVisible]; // Need to fix this since deprecated // [application prefersStatusBarHidden:NO]; // [application preferredS :UIStatusBarStyleDefault]; // [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; return YES; } 

大小写缺less应用程序图标下的常规设置中的LaunchScreen.storyboard并启动图像:

在这里输入图像说明

以上function不工作检查按照以下步骤:

  1. 导航到项目设置
  2. 在“应用程序图标和启动图像”下点击“使用资产目录”
  3. 在出现的popup窗口中select“Migrate”。

这应该解决这个问题。

在这里输入图像说明

首先请将这些图像添加到Images.xcassets目录中。 你也可以改变这些图像,但要小心保持大小和标题:)

用他们的头衔命名。 为Default.png

为Default.png

Default-Portrait-736h@3x.png

Default-Portrait-736h@3x.png

Default-667h@2x.png

Default-667h@2x.png

默认568h.png

默认568h.png

然后在常规selectLaunchImage:应用程序图标和启动图像:启动图像源

检查您的项目是否有LaunchScreen.storyboard文件。 如果没有这个,Xcode会对你的屏幕大小做一个假设。 创build一个LaunchScreen.storyboard文件并将其添加到您的项目。

如果您不想添加任何启animation面,如果它不提供任何目的,如在这种情况下是白色或黑色,您可以简单地添加launchScreen.xib并select它启动屏幕文件选项目标设置。