使用启动屏幕(.xib)停止缩放 [英] Using a launch screen (.xib) stops scaling

查看:95
本文介绍了使用启动屏幕(.xib)停止缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我了解,iOS 8的应用应将故事板文件作为启动屏幕而不是图像.我创建了一个非常简单的启动屏幕文件,该文件具有任意宽度和高度,并具有一个纯文本标签,显示为占位符",并将其设置为我的启动屏幕.但是,当我尝试在iPhone 6和6 Plus模拟器上运行我的应用程序时,背景周围出现黑条,并且主菜单上的按钮不正确.在5s或iPad中似乎不存在该问题.我的大部分资产都没有针对6和6 Plus进行优化,因为它们是在发布之前创建的.这就是为什么发生这种情况吗?或者是别的什么?预先感谢.

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.

显然,放入启动屏幕会阻止应用程序自动缩放.是否可以同时具有启动屏幕和保持应用程序缩放?还是我需要制作新资产?

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?

推荐答案

这是一个老问题了,我最终使用了启动图像而不是启动屏幕,但是您可以通过使用约束来解决这个问题.如果在视图中的项目上设置顶部,底部,前导和/或尾随约束,则它将自动缩放以适应这些约束(如果可能).对于文本,它具有autoshrink属性,您可以更改为最小字体大小(而不是固定的字体大小),尽管我不确定如何放大文本.自动布局文档为此处.

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.

这篇关于使用启动屏幕(.xib)停止缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆