iOS 8 - 启动屏幕文件的背景渐变 [英] iOS 8 - Background gradient for launch screen file

查看:79
本文介绍了iOS 8 - 启动屏幕文件的背景渐变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将背景渐变应用于启动屏幕文件?

How would you apply a background gradient to a launch screen file?

您是否应该只为背景包含大图像,还是可以在启动时运行代码屏幕文件做自定义绘图?

Are you supposed to just include large image for the background or can you run code in a launch screen file to do custom drawing?

推荐答案

您无法在启动屏幕中运行代码或使用任何自定义类。

You cannot run code or use any custom classes in the Launch Screen.

您必须提供一个可伸缩的图像,其中包含足够的数据,以便在所有分辨率下都可行。

You'll have to supply a stretchable image, which contains enough data for it to be viable in all resolutions.

此外,你可以利用 @ 2x @ 3x 修饰符。
iPhone 6 plus将尝试加载 @ 3x 修饰符,AFAIK。

Also, you could take advantage of the @2x and @3x modifiers. iPhone 6 plus will try to load a @3x modifier, AFAIK.

作为最后的手段,如果启动屏幕xib不够用,您仍然可以使用UILaunchImages plist键,并指定最低版本8.0的图像。缺点是Xcode不会自动生成那些,所以你必须手动编写。还记得iPhone 6 plus图像的修饰符是 @ 3x

As a last resort, if the Launch Screen xib is not enough for you, you could still use the UILaunchImages plist key, and specify images for minimum version of 8.0. The downside is that Xcode does not automatically generate those for you, so you'll have to write those manually. Also remember that the modifier for iPhone 6 plus images is @3x

例如:

UILaunchImage = Default // This is for iOS 6, if you need it

UILaunchImages // iOS 7, 8
- [0]
-   UILaunchImageName = Default
-   UILaunchImageMinimumOSVersion = 7.0
-   UILaunchImageSize = {320, 480}
-   UILaunchImageOrientation = Portrait
- [1]
-   UILaunchImageName = Default-568h
-   UILaunchImageMinimumOSVersion = 7.0
-   UILaunchImageSize = {320, 568}
-   UILaunchImageOrientation = Portrait
- [2]
-   UILaunchImageName = Default-667h
-   UILaunchImageMinimumOSVersion = 8.0
-   UILaunchImageSize = {375, 667}
-   UILaunchImageOrientation = Portrait
- [3]
-   UILaunchImageName = Default-736h
-   UILaunchImageMinimumOSVersion = 8.0
-   UILaunchImageSize = {414, 736}
-   UILaunchImageOrientation = Portrait

P. S。上面的 plist 对于那些正在努力应对图像目录或启动屏幕文件的本地化的人来说也是一个完美的解决方案。

P.S. The plist above is also a perfect solution for those who are struggling with the localization of Image Catalogs or Launch Screen files.

这篇关于iOS 8 - 启动屏幕文件的背景渐变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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