[英]Xcode: how to make a launchScreen storyboard
I m new in xcode, and right now i just need to build a launchScreen storyboard. 我是xcode的新手,现在我只需要构建一个launchScreen故事板。 but i don't know how to do this simple think :
但我不知道该怎么做:
I need to put an image at exactly 20 pixels from the bottom of the status bar (and in the launchscreen the status bar seen to be transparent i don't know if it's matter). 我需要将图像放置在距离状态栏底部恰好20个像素处(并且在启动屏幕中,状态栏看起来是透明的,我不知道这是否重要)。 I also need to center horizontally this image (look easy but didn't find yet how to do)
我还需要将该图像水平居中(看起来很简单,但是还没找到方法)
Someone can help me to do this ? 有人可以帮助我做到这一点吗?
I also have 4 version of my image for different scale factor (1x, 2x, 3x and even 4x) but I don't know how (and if it's possible) to set up an image dedicated for a particular scale factor. 我的图像也有4个版本,分别用于不同的比例因子(1x,2x,3x甚至4x),但是我不知道如何(如果可能)设置专用于特定比例因子的图像。 I even don't know how to import a image in my launchScreen :(
我什至不知道如何在我的launchScreen中导入图像:(
The launch screen is available as an image asset in the Assets.xcassets
folder within your project. 启动屏幕可用作项目中
Assets.xcassets
文件夹中的图像资产。 You can link same image with multiple scaled versions(1x, 2x and 3x) referenced under a single name. 您可以将同一图像与以单个名称引用的多个缩放版本(1x,2x和3x)链接。
If not available by default, just create a new image asset with any name and specify this under the Launch Images Source
tab in your targets General settings
. 如果默认情况下不可用,则只需创建一个具有任何名称的新图像资产,然后在目标“
General settings
的“ Launch Images Source
选项卡下进行指定。
Alternatively, latest xcode versions suggest use of a launch screen storyboard. 另外,最新的xcode版本建议使用启动屏幕故事板。 This comes under the default file name
LaunchScreen.storyboard
. 这在默认文件名
LaunchScreen.storyboard
。 You can create a scene here as you normally do in storyboards and specify it as the launch screen. 您可以像在故事板中通常那样在此处创建场景,并将其指定为启动屏幕。
Hope this helps :) 希望这可以帮助 :)
The LaunchScreen is created by default when starting new projects. 启动新项目时,默认情况下会创建LaunchScreen。
You can add it in existing project too. 您也可以将其添加到现有项目中。
It's a nib where you can pub an UIImageView
linked to you base image, with @2x and @3x image. 这是一个笔尖,您可以在其中发布链接到您的基础图像的
UIImageView
以及@ 2x和@ 3x图像。 You also can use the SizeClass to set customize your LaunchScreen 您还可以使用SizeClass设置自定义您的LaunchScreen
If your deployment target of application is less then 8.0 (ie you want to give support for ios 7 also) then you need to set launch screen two time : 如果您的应用程序的部署目标是8.0以下(即您也要提供对ios 7的支持),则需要两次设置启动屏幕:
1) from launchscreen.storyboard(ios 8.0 and greater) - It is simple view controller. 1)从launchscreen.storyboard(ios 8.0及更高版本)-这是简单的视图控制器。 Drag and drop imageview on it and set your image to it
拖放imageview并将其设置为它
2) from Assets.xcassets
and new launch screen by clicking +
button and the from project settings change launch image source
to that launch screen file you have add in assets 2)从
Assets.xcassets
和新启动屏幕中,通过单击+
按钮,然后从项目设置将launch image source
更改为您已在资产中添加的启动屏幕文件
So, if your deployment target is 8.0 or greater then you only need to set from launchscreen.storyboard. 因此,如果您的部署目标是8.0或更高,则只需从launchscreen.storyboard进行设置。
Hope this will help :) 希望这会有所帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.