xcode 在ios中为launchscreen.xib设置背景图片
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29672955/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Set background image for launchscreen.xib in ios
提问by Sidharth J Dev
I need to set a background color or background image in my iOS application's launch screen. I was wondering if there was a code similar to:
我需要在我的 iOS 应用程序的启动屏幕中设置背景颜色或背景图像。我想知道是否有类似的代码:
self.view.backgroundcolor=[UIColor redColor];
Thank you
谢谢
回答by Ajay Gabani
If you want to set background image for launch screen than there is two way:
如果要为启动屏幕设置背景图像,有两种方法:
- Use
image.axassets
and add new LaunchImage set in it. - You can add
UIImageView
inLaunchScreen.xib
and set image to it.
- 使用
image.axassets
并在其中添加新的 LaunchImage 集。 - 您可以添加
UIImageView
在LaunchScreen.xib
和一套图像它。
If you want to set background colour for launch image than add UIView
in LaunchScreen.xib
and set backgroundColor
propertity of it.
如果你想设置背景颜色不是添加启动图像UIView
中LaunchScreen.xib
和组backgroundColor
的它propertity。
Both way is easy but I preferred to go with image.axassets LunchImage set.
两种方式都很简单,但我更喜欢使用 image.axassets LunchImage 集。
Note: If you use image.axassets
LaunchImage than do not forget to migrate this set with application.
注意:如果您使用image.axassets
LaunchImage,请不要忘记将此集与应用程序一起迁移。