1、通过获取全局info.plist中的UILaunchImages属性,这是一个字典,大概格式如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | <__nsarraym 0x6000002413b0>( { UILaunchImageMinimumOSVersion = "8.0"; UILaunchImageName = "LaunchImage-800-Portrait-736h"; UILaunchImageOrientation = Portrait; UILaunchImageSize = "{414, 736}"; }, { UILaunchImageMinimumOSVersion = "8.0"; UILaunchImageName = "LaunchImage-800-667h"; UILaunchImageOrientation = Portrait; UILaunchImageSize = "{375, 667}"; }, { UILaunchImageMinimumOSVersion = "7.0"; UILaunchImageName = "LaunchImage-700"; UILaunchImageOrientation = Portrait; UILaunchImageSize = "{320, 480}"; }, { UILaunchImageMinimumOSVersion = "7.0"; UILaunchImageName = "LaunchImage-700-568h"; UILaunchImageOrientation = Portrait; UILaunchImageSize = "{320, 568}"; } )</__nsarraym> |
2、遍历这个数组,找到图片尺寸为当前屏幕尺寸的字典,取出文件名即可
3、封装成工具类方法[……]