Adding iOS 7 version of iPhone 4-inch launch image to project breaks launch image when run on iOS 7

江枫思渺然 提交于 2019-12-18 12:34:38

问题


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.


回答1:


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!




回答2:


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.




回答3:


LaunchImage import a 640*1136 picture,

BTW, LaunchImage in Images.xcassets

sample picture



来源:https://stackoverflow.com/questions/19732975/adding-ios-7-version-of-iphone-4-inch-launch-image-to-project-breaks-launch-imag

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!