iOS开发-iPhone12屏幕尺⼨适配⼤全
没有iPhone12,适配还是要做的
⼀、像素⼤⼩
新增4款⼿机3种分辨率,直接上图:
iphone12适配.png
⼆、机型判断的宏定义
更新下宏定义,⼜可以愉快的写bug了。
//判断iPad
#defineDX_UI_IS_IPAD(UI_USER_INTERFACE_IDIOM()==UIUrInterfaceIdiomPad)
//判断iPhoneX
#defineDX_Is_iPhoneX([UIScreeninstancesRespondToSelector:@lector(currentMode)]?CGSizeEqualToSize(CGSizeMake(1125,2436),[[UIScreenmainScreen]curren
//判断iPHoneXr|11
#defineDX_Is_iPhoneXR([UIScreeninstancesRespondToSelector:@lector(currentMode)]?CGSizeEqualToSize(CGSizeMake(828,1792),[[UIScreenmainScreen]curre
//判断iPHoneXs|11Pro
#defineDX_Is_iPhoneXS([UIScreeninstancesRespondToSelector:@lector(currentMode)]?CGSizeEqualToSize(CGSizeMake(1125,2436),[[UIScreenmainScreen]curr
//判断iPhoneXsMax|11ProMax
#defineDX_Is_iPhoneXS_MAX([UIScreeninstancesRespondToSelector:@lector(currentMode)]?CGSizeEqualToSize(CGSizeMake(1242,2688),[[UIScreenmainScreen
//判断iPhone12_Mini
#defineDX_Is_iPhone12_Mini([UIScreeninstancesRespondToSelector:@lector(currentMode)]?CGSizeEqualToSize(CGSizeMake(1080,2340),[[UIScreenmainScreen
//判断iPhone12|12Pro
#defineDX_Is_iPhone12([UIScreeninstancesRespondToSelector:@lector(currentMode)]?CGSizeEqualToSize(CGSizeMake(1170,2532),[[UIScreenmainScreen]curre
//判断iPhone12ProMax
#defineDX_Is_iPhone12_ProMax([UIScreeninstancesRespondToSelector:@lector(currentMode)]?CGSizeEqualToSize(CGSizeMake(1284,2778),[[UIScreenmainScre
//x系列
#defineDX_IS_IPhoneX_All(DX_Is_iPhoneX||DX_Is_iPhoneXR||DX_Is_iPhoneXS||DX_Is_iPhoneXS_MAX||DX_Is_iPhone12_Mini||DX_Is_iPhone12||DX_Is_iPhone
Final
如果有什么问题,还请⼤家指正。
开发愉快!
本文发布于:2022-12-28 09:43:28,感谢您对本站的认可!
本文链接:http://www.wtabcd.cn/fanwen/fan/90/45866.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |