You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

59 lines
2.8 KiB

//
// 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;
#define GJText(x) NSLocalizedString(x, nil)
#define KSizeNO 20
#endif /* Const_h */