iOS14、iPhone12适配

  1. cell添加button,不能[self addSubview:self.cellBtn]会导致button不响应点击事件。 需要[self.contentView addSubview:self.cellBtn]

  2. iOS13.4以上,UIDatePicker 需要加入 preferredDatePickerStyle ,不然样式错乱。

if (@available(iOS 13.4, *)) {
      picker.preferredDatePickerStyle = UIDatePickerStyleWheels;
}
  1. TZImagePickerController需要升级到最新版本3.5.2

  2. 其他第三方,涉及到全面屏判断的地方,可能也要看下。

  3. iPhone12机型适配,新增三种全面屏尺寸。要修改判断是否全面屏的宏。

//判断iPhoneX
#define IS_IPHONE_X ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iPHoneXr
#define IS_IPHONE_Xr ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iPhoneXs
#define IS_IPHONE_Xs ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iPhoneXs Max
#define IS_IPHONE_Xs_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iPhone12 mini
#define IS_IPHONE_12_Mini ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1080, 2340), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iPhone12
#define IS_IPHONE_12 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1170, 2532), [[UIScreen mainScreen] currentMode].size) : NO)
//判断iPhone12pro max
#define IS_IPHONE_12_Max ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1284, 2778), [[UIScreen mainScreen] currentMode].size) : NO)

#define IS_IPhoneX_All (IS_IPHONE_X || IS_IPHONE_Xr || IS_IPHONE_Xs || IS_IPHONE_Xs_Max || IS_IPHONE_12_Mini== YES || IS_IPHONE_12== YES || IS_IPHONE_12_Max== YES)
或者根据安全距离判断
#define IS_IPhoneX_All ([UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom != 0)

你可能感兴趣的:(iOS14、iPhone12适配)