我需要在我的 iOS 应用程序的启动屏幕中设置背景颜色或背景图像。我想知道是否有类似的代码:
self.view.backgroundcolor=[UIColor redColor];
谢谢
最佳答案
如果你想为启动屏幕设置背景图片,有两种方法:
- 使用
image.axassets
并在其中添加新的 LaunchImage 集。 - 您可以添加
UIImageView
在LaunchScreen.xib
并为其设置图像。
如果你想为启动图像设置背景颜色而不是添加 UIView
在LaunchScreen.xib
并设置 backgroundColor
它的属性。
这两种方法都很简单,但我更喜欢使用 image.axassets LunchImage 集。
注意:如果您使用 image.axassets
LaunchImage 不要忘记用应用程序迁移这个集合。
关于ios - 在 ios 中为 launchscreen.xib 设置背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29672955/