App launches in full screen in simulator, but not

2020-02-10 06:53发布

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 (i.e. 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.

4条回答
Evening l夕情丶
2楼-- · 2020-02-10 07:44

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.

查看更多
一夜七次
3楼-- · 2020-02-10 07:44

For me it was fixed after adding the images with all sizes

查看更多
聊天终结者
4楼-- · 2020-02-10 07:48

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

查看更多
家丑人穷心不美
5楼-- · 2020-02-10 07:51

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.

App Icons and Launch Images screenshot

查看更多
登录 后发表回答