// // Const.h // ChineseAgri-businesses // // Created by ecell on 2022/6/29. // #ifndef Const_h #define Const_h #define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) #define IS_IOS_11 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11.f) #define IS_IPHONE_X (IS_IOS_11 && IS_IPHONE && (MIN([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 375 && MAX([UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) >= 812)) //Frame #define NativeHeight [[UIScreen mainScreen] nativeBounds].size.height #define iPhoneX (IS_IPHONE_X ? YES : NO) #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width #define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height #define NavBarHeight self.navigationController.navigationBar.bounds.size.height #define StatusBarHeight [UIApplication sharedApplication].statusBarFrame.size.height #define kDefaultNavBarHeight ([UIApplication sharedApplication].statusBarFrame.size.height + 44.0) // 适配iPhone X Tabbar高度 #define iPhoneX_TabbarHeight (iPhoneX ? (51.f+34.f) : 51.f) #define iPhoneX_TabbarSafeBottomMargin (iPhoneX ? 34.f : 0.f) #define TabBarHeight self.tabBarController.tabBar.bounds.size.height +iPhoneX_TabbarSafeBottomMargin // 适配iPhone X 导航栏高度 //#define iPhoneX_NavHeight (iPhoneX ? 88.f : 64.f) #define iPhoneX_NavHeight [UIDevice vg_navigationFullHeight] #define iPhoneSE (SCREEN_HEIGHT <= 568 ? YES : NO) #define kSubHight(a) ((a / 667.0) * SCREEN_HEIGHT) #define kSubWidth(b) ((b / 375.0) * SCREEN_WIDTH) #define kInitHight(a) (iPhoneSE ? kSubHight(a) : a) #define kInitWidth(b) (iPhoneSE ? kSubWidth(b) : b) //不同屏幕尺寸适配,UI : 750x1334 #define kScreenWidthRatio (SCREEN_WIDTH / 375.0) #define kScreenHeightRatio (SCREEN_HEIGHT / 667.0) #define AdaptedWidth(x) ceilf((x) * kScreenWidthRatio) #define AdaptedHeight(x) ceilf((x) * kScreenHeightRatio) #define AdaptedFontSize(R) AdaptedWidth(R) #define Adapted(x) ceilf((x) * kScreenWidthRatio) //NSUserDefaults #define UserDefaults [NSUserDefaults standardUserDefaults] #define kWeakSelf(type) __weak typeof(type) weak##type = type; #define WeakSelf __weak typeof(self) weakSelf = self; #define StrongSelf __strong typeof(self) strongSelf = weakSelf; #define SNJJSELF __weak typeof(self)snjjSelf = self; #define SNJJWEAK __weak typeof(self)snjjSelf = self; //高德地图 Key #define AMapKey @"cc2e8880f53e768cc84c374f403ef4d4" #define GJText(x) NSLocalizedString(x, nil) #define KSizeNO 20 #endif /* Const_h */