Using a launch screen (.xib) stops scaling

﹥>﹥吖頭↗ 提交于 2020-07-08 19:28:03

问题


It's my understanding that apps for iOS 8 should have a storyboard file as launch screen rather than an image. I've created a really simple launch screen file that has any width and any height, and has one label of plain text reading "placeholder" and set it as my launch screen. However, when I try to run my app on the iPhone 6 and 6 Plus simulators, there's black bars around the background and the buttons on the main menu are out of place. The problem doesn't seem to be present in the 5s or iPad. Most of my assets aren't optimized for the 6 and 6 Plus though, since they were created before they came out. Is that why this is happening? Or is it something else? Thanks in advance.

Edit: Apparently, putting in a launch screen stops the app from automatically scaling. Is there a way to have both a launch screen, and keep the app scaling? Or do I need to make new assets?


回答1:


This is a bit of an old question, and I ended up using a launch image instead of a launch screen, but you can probably solve this by using constraints. If you set top, bottom, leading, and/or trailing constraints on an item in the view, it'll scale itself to fit those constraints (if possible). For text, it has the autoshrink property which you can change to minimum font scale (instead of fixed font size), though I'm not sure how you can scale text up. The autolayout documentation is here.




回答2:


To create a launch screen from a xib file first create a new file from under “User Interface” and select the option called “Launch Screen”

create launch screen file

Using autolayout, design the first view of you app so it scales to suit all resolutions that your app supports.

Using the new Launch Screen

Under the app setting select the newly created Launch Screen from the app options.

select Launch Screen File

This is the example for using a xib file. It can also be done using storyboard as shown in Ole Begemann blog



来源:https://stackoverflow.com/questions/26329882/using-a-launch-screen-xib-stops-scaling

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