简体   繁体   English

在xcode中居中启动屏幕

[英]Centering Launch Screen in xcode

I set up a Launch Screen in xcode with Inferred Size, Simulated Size: Fixed. 我在xcode中用推断的大小,模拟的大小设置了启动屏幕:固定。 I put a View in it that covers the whole View Controller. 我在其中放置了一个涵盖整个View Controller的View。 In that View is an image and a label. 在该视图中是图像和标签。 Both the image and label have height and width constraints, in addition to constraints centering both items with the superview center, yet somehow whenever I run the simulation the label is centered on the screen but the image is off to the right. 图像和标签都具有高度和宽度约束,除了将两个项目都以超级视图中心居中的约束之外,无论如何,无论何时我运行模拟,标签都位于屏幕的中心,但是图像位于右侧。 Anyone know what I need to fix here? 有人知道我需要在这里解决吗? Thanks! 谢谢!

屏幕截图

Edit: It turns out I had a previous launch screen file listed in Info.plist. 编辑:原来我在Info.plist中列出了以前的启动屏幕文件。 I updated it with the new launch screen file name and it worked. 我使用新的启动屏幕文件名对其进行了更新,并且可以正常工作。 I also changed the launch screen to remove the splash. 我还更改了启动屏幕以删除启动画面。

Use width and height equal to, and align your view horizontally in the container.. 使用宽度和高度等于的高度,并在容器中水平对齐视图。

Also, as per Apple's human guidelines they advise against having a splash screen. 另外,根据Apple的人工指导,他们建议不要使用启动屏幕。

Workaround of this issue is to not place image vertically centered. 此问题的解决方法是不要将图像垂直居中放置。 You can move image a bit to top or bottom. 您可以将图像稍微移到顶部或底部。 In such way issue won't be visible. 这样,问题将不可见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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