相信很多小伙伴都已經(jīng)開始適配齊劉海的屏幕拉呵晚!
跟大家分享一下吧--
適配iPhoneX主要就是針對(duì)頂部和底部做一些跳轉(zhuǎn),
一些參數(shù):
iPhoneX的高度是812.0送讲;
iPhoneX頂部需要適配的空隙是22截型;
iPhoneX底部需要適配的空隙是34陶冷;
#define _BottomM ([UIScreen mainScreen].bounds.size.height == 812.0 ? 34.0 : 0.0)
#define _TopM ([UIScreen mainScreen].bounds.size.height == 812.0 ? 24.0 : 0.0)
我的做法是把這2個(gè)空隙參數(shù)寫出來,
[self.footerView mas_makeConstraints:^(MASConstraintMaker *make) {
? ? ? ? make.left.right.equalTo(self.view);
? ? ? ? make.bottom.equalTo(self.view).offset(-CC_BottomM);
? ? ? ? make.height.equalTo(@64);
? ? }];
? ? [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
? ? ? ? make.left.right.equalTo(self.view);
? ? ? ? make.top.equalTo(self.view).offset(64+CC_TopM);
? ? ? ? make.bottom.equalTo(self.footerView.mas_top).offset(0);
? ? }];
針對(duì)布局的時(shí)候這樣寫上,是不是很方便咯须妻!
嘿嘿 ^..^