UItableView设置如下:
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, YDYHeight_SafeArea, 0);
上拉加载安全区适配
self.tableView.mj_footer.ignoredScrollViewContentInsetBottom = YDYHeight_SafeArea;
宏定义:
#define YDYIS_IPPHONE_XSerious @available(iOS 11.0, *) && UIApplication.sharedApplication.keyWindow.safeAreaInsets.bottom > 0.0 && UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone
#define YDYHeight_StatusBar (YDYIS_IPPHONE_XSerious ? 44.0 : 20.0)
#define YDYHeight_NavBar (YDYIS_IPPHONE_XSerious ? 88.0 : 64.0)
#define YDYHeight_TabBar (YDYIS_IPPHONE_XSerious ? 83.0 : 49.0)
#define YDYHeight_SafeArea (YDYIS_IPPHONE_XSerious ? 34.0 : 0)
目前只需要适配以上就差不多了。
网友评论