iOS iPadPro 黑边问题解决

问题描述

因为出现了不同size的iPad设备,在使用LuanchImage方式设置启动图的时候就会出现黑边问题。
原因是LuanchImage中对于iPad的启动图只有两种:
768 * 1024 (@1x)
1536 * 2048 (@2x)

解决办法

方法一:
不使用LuanchImage方式,改用Infoplist文件中添加Key的方式来解决。
Key码如下:

UILaunchImages
    
        
            UILaunchImageMinimumOSVersion
            7.0
            UILaunchImageName
            iPhone_5s
            UILaunchImageOrientation
            Portrait
            UILaunchImageSize
            {320, 568}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPhone_6s
            UILaunchImageOrientation
            Portrait
            UILaunchImageSize
            {375, 667}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPhone_6sp
            UILaunchImageOrientation
            Portrait
            UILaunchImageSize
            {414, 736}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPhone_6x
            UILaunchImageOrientation
            Portrait
            UILaunchImageSize
            {375, 812}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPhone_6xsp
            UILaunchImageOrientation
            Portrait
            UILaunchImageSize
            {414, 896}
        
        
            UILaunchImageMinimumOSVersion
            7.0
            UILaunchImageName
            iPhone_5s_land
            UILaunchImageOrientation
            Landscape
            UILaunchImageSize
            {320, 568}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPhone_6s_land
            UILaunchImageOrientation
            Landscape
            UILaunchImageSize
            {375, 667}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPhone_6sp_land
            UILaunchImageOrientation
            Landscape
            UILaunchImageSize
            {414, 736}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPhone_6x_land
            UILaunchImageOrientation
            Landscape
            UILaunchImageSize
            {375, 812}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPhone_6xsp_land
            UILaunchImageOrientation
            Landscape
            UILaunchImageSize
            {414, 896}
        
    
    UILaunchImages~ipad
    
        
            UILaunchImageMinimumOSVersion
            7.0
            UILaunchImageName
            iPad_768_1024_port
            UILaunchImageOrientation
            Portrait
            UILaunchImageSize
            {768, 1024}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPad_1024_1366_port
            UILaunchImageOrientation
            Portrait
            UILaunchImageSize
            {1024,1366}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPad_834_1112_port
            UILaunchImageOrientation
            Portrait
            UILaunchImageSize
            {834,1112}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPad_834_1194_port
            UILaunchImageOrientation
            Portrait
            UILaunchImageSize
            {834,1194}
        
        
            UILaunchImageMinimumOSVersion
            7.0
            UILaunchImageName
            iPad_768_1024_land
            UILaunchImageOrientation
            Landscape
            UILaunchImageSize
            {768, 1024}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPad_1024_1366_land
            UILaunchImageOrientation
            Landscape
            UILaunchImageSize
            {1024,1366}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPad_834_1112_land
            UILaunchImageOrientation
            Landscape
            UILaunchImageSize
            {834,1112}
        
        
            UILaunchImageMinimumOSVersion
            8.0
            UILaunchImageName
            iPad_834_1194_land
            UILaunchImageOrientation
            Landscape
            UILaunchImageSize
            {834,1194}
        
    

PS:
1> UILaunchImages表示的是iPhone使用图
2> UILaunchImages~ipad表示的是iPad使用图
3> 以上是目前最全的(除了320*480,当然这个也可以加上,按需)
根据自己的应用需要在什么设备上使用就添加什么screen size的key即可。图片名称不需要带@1x、@2x、@3x。
4> 因为iPhone上有些是3倍图,所以建议iPhone和iPad都统一切好@1x、@2x、@3x三组图,然后导入到工程中即可。

方法二:
还是使用LuanchImage,自己手动添加所需元素到Contents.json中,按照格式添加。但是有一个问题是不确定未使用的subtype是啥,所以需要自己凭直觉去试验,目前本人还未尝试,大家可以测试下。


iOS iPadPro 黑边问题解决_第1张图片
Snip20191015_9.png

PS:推荐方式一

参考

iPad Pro 12.9寸 11寸、10.5寸黑边解决方案
ipad pro 11寸四周黑边,屏幕适配解决

你可能感兴趣的:(iOS iPadPro 黑边问题解决)