简体   繁体   中英

App launches in full screen in simulator, but not on device

This is an Xcode 6 Swift project. When choosing iPhone 5 or 5s in the simulator, the app launches at full screen height. However, when running the app on an actual device (an iPhone 5s), the screen is only iPhone 4 in height (ie black bars appear at the top and bottom of the screen).

The strange thing is that I've re-created this project from another test project - and in the original project I didn't have this problem.

I've performed a text-compare on the storyboard xml files for each, and both are mostly identical. I've also looked at the Build Settings for each, and can't see any obvious differences. Finally, the json files specified in the "Images.xcassets" directory for each are the same.

Managed to fix the problem. In the General settings for the target, under "App Icons and Launch Images" I clicked the "Use Asset Catalog" button and followed the options.

应用程序图标和启动图像截图

Place the Launch screen images for both iphone 5 and iphone 4 . Put the size of the default-568@2x image as 640 x 1136 .

May be you missed this size of splash screen in your project.

对我来说,在添加所有尺寸的图像后,它已得到修复

For me, this was because I'd saved the file in photoshop format, but with a PNG extension. The emulator loaded the file, but the actual device couldn't. Wasted 3 hours messing with asset catalogs before I figured it out!

Blog post on subject

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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