Adding iOS 7 version of iPhone 4-inch launch image

2019-02-05 08:50发布

I'm running into a problem on our landscape only app that targets iOS 6 and 7. Xcode gives me the following warning:

An iPhone Retina (4-inch) launch image for iOS 7.0 and later is required.

If I add the required images, when I launch the app on iOS 7, I get a black launch image shown. On iOS 6, it displays correctly. But without the images, it works just fine on both iOS 6 and 7.

I am already using Asset Catalogs in this project, so I don't think that's an issue.

I would really like to get rid of this warning, but I haven't been able to figure out a way around it.

标签: ios7 xcode5
3条回答
男人必须洒脱
2楼-- · 2019-02-05 09:37

LaunchImage import a 640*1136 picture,

BTW, LaunchImage in Images.xcassets

sample picture

查看更多
我想做一个坏孩纸
3楼-- · 2019-02-05 09:41

In my case (landscape only app), I was able to fix it by doing the following:

  • adding portrait to the supported orientations for the iPhone in my Info.plist

  • replacing shouldAutorotate: methods with supportedInterfaceOrientations and preferredInterfaceOrientationForPresentation in my view controllers.

  • added application:supportedInterfaceOrientationsForWindow: to my app delegate.

Also I had to make sure that in the Info.plist that the portrait orientation was listed first. Xcode had added it to the end of the list, but if it was there, it would still be a black display on launch. Moved to the top, it was properly detected by iOS when the app was launching.

查看更多
Animai°情兽
4楼-- · 2019-02-05 09:44

XCode is looking for Portrait orientation for iPhone. You need to provide it for the launch image, but don’t let your application to rotate when device is in Portrait mode.
In order to do this you need to do the following:

  • Go to General -> Deployment Info -> Device Orientation. Deselect Landscape Left and Landscape Right. Select Portrait, then Landscape Left and Landscape Right, order is important!
  • Add the following function to your code (if not yet):

-(NSUInteger)supportedInterfaceOrientations { return (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight); }

That’s all!

查看更多
登录 后发表回答