一句话判断设备是否为iPhoneXSeries
定义一个方法,一句话调用
+ (BOOL)isIPhoneXSeries{
BOOL iPhoneXSeries = NO;
if (UIDevice.currentDevice.userInterfaceIdiom != UIUserInterfaceIdiomPhone) {
return iPhoneXSeries;
}
if (@available(iOS 11.0, *)) {
UIWindow *mainWindow = [UIApplication sharedApplication].delegate.window;
if (mainWindow.safeAreaInsets.bottom > 0.0) {
iPhoneXSeries = YES;
}
}
return iPhoneXSeries;
}
网友评论