IPad Pro 12.9英寸版本的界面适配

IOS开发怎么样适配12.9英寸的Pad Pro

12.9英寸的iPad pro,宽高是(1366*1024),Pad其他版本都是(1024*768),按普通尺寸开发的pad应用,最后需要兼容一下pro。为此我自己写了三个宏。

应该写在公共文件中

#define FULL_SCREEN_RECT CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)

#define DEVICES_IS_PRO_12_9 ([UIScreen mainScreen].bounds.size.width == 1366)

#define SCALE_TO_PRO (DEVICES_IS_PRO_12_9? (1366.0/1024.0): 1)

用法举例

CGRectMake(0, 0, 1024 * SCALE_TO_PRO, 768 * SCALE_TO_PRO)

只要把CGRect或者CGPoint乘以SCALE_TO_PRO,就兼容iPad pro 12.9了。

猜你喜欢

转载自blog.csdn.net/chenhy8208/article/details/77435329