// // BGSystemMacro.h // BuguLive // // Created by xfg on 16/8/3. // Copyright © 2016年 xfg. All rights reserved. // 系统宏 #ifndef FWSystemMacro_h #define FWSystemMacro_h #import "GlobalVariables.h" #import "LLFans.h" // View 圆角 #define ViewRadius(View, Radius)\ \ [View.layer setCornerRadius:(Radius)];\ [View.layer setMasksToBounds:YES] //#define ASLocalizedString(key) [NSString stringWithFormat:@"%@", [[NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults] objectForKey:@"appLanguage"]] ofType:@"lproj"]] localizedStringForKey:(key) value:nil table:@"ASLocalized"]] #define KAppLanguage @"appLanguage" //#define KAppLanguageFirst @"appLanguage_first" #define IPHONE_X \ ({BOOL isPhoneX = NO;\ if (@available(iOS 11.0, *)) {\ isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\ }\ (isPhoneX);}) //根据ip6的屏幕来拉伸 #define kRealValue(with) ((with)*(kScreenW/375.0f)) // 屏幕frame,bounds,size,scale #define kScreenFrame [UIScreen mainScreen].bounds #define kScreenBounds [UIScreen mainScreen].bounds #define kScreenSize [UIScreen mainScreen].bounds.size #define kScreenScale [UIScreen mainScreen].scale #define kScreenW [[UIScreen mainScreen] bounds].size.width #define kScreenH [[UIScreen mainScreen] bounds].size.height #define kScaleW (kScreenW)*(kScreenScale) #define kScaleH (kScreenH)*(kScreenScale) #define KGiftViewHeight kRealValue(358) + MG_BOTTOM_MARGIN // 屏幕宽度,会根据横竖屏的变化而变化 #define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width) // 屏幕高度,会根据横竖屏的变化而变化 #define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height) #define kScaleWidth [[UIScreen mainScreen] bounds].size.width/375.00 #define kScaleHeight [[UIScreen mainScreen] bounds].size.height/667.00 // 主窗口的宽、高 #define kMainScreenWidth MainScreenWidth() #define kMainScreenHeight MainScreenHeight() static __inline__ CGFloat MainScreenWidth() { return UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ? [UIScreen mainScreen].bounds.size.width : [UIScreen mainScreen].bounds.size.height; } static __inline__ CGFloat MainScreenHeight() { return UIInterfaceOrientationIsPortrait([UIApplication sharedApplication].statusBarOrientation) ? [UIScreen mainScreen].bounds.size.height : [UIScreen mainScreen].bounds.size.width; } // 状态栏、导航栏、标签栏高度 #define kStatusBarHeight ([UIApplication sharedApplication].statusBarFrame.size.height) #define kNavigationBarHeight ([GlobalVariables sharedInstance].appNavigationBarHeight ? : self.navigationController.navigationBar.frame.size.height) #define kTabBarHeight ([GlobalVariables sharedInstance].appTabBarHeight ? : self.tabBarController.tabBar.frame.size.height) // 顶部距离 #define MG_TOP_MARGIN (CGFloat)(isIPhoneX() ? 35 : 22) #define MG_BOTTOM_MARGIN 22 #define MG_BOTTOM_SAFE_HEIGHT (CGFloat)(isIPhoneX() ? 34 : 0) #define kTopHeight (kStatusBarHeight + kNavigationBarHeight) #define scale_hight1 kScreenH < 600 ? 50 : 55 #define scale_hight kScreenH > 667 ? 60 : scale_hight1 // 当前所在window #define kCurrentWindow [AppDelegate sharedAppDelegate].sus_window.rootViewController ? [AppDelegate sharedAppDelegate].sus_window : [AppDelegate sharedAppDelegate].window #define STATUS_BAR_HEIGHT \ ({ \ CGFloat height = 0.0; \ if (@available(iOS 13.0, *)) { \ UIStatusBarManager *manager = [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager; \ height = manager.statusBarFrame.size.height; \ } else { \ height = [UIApplication sharedApplication].statusBarFrame.size.height; \ } \ height; \ }) #define IS_IPHONE_X_SERIES \ ({ \ BOOL isPhoneX = NO; \ if (@available(iOS 11.0, *)) { \ isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0; \ } \ isPhoneX; \ }) #define NAVIGATION_BAR_HEIGHT (STATUS_BAR_HEIGHT + 44.0) #define TAB_BAR_HEIGHT (IS_IPHONE_X_SERIES ? 83.0 : 49.0) #define SAFE_AREA_BOTTOM (IS_IPHONE_X_SERIES ? 34.0 : 0) //// 当前系统版本号 //#define kCurrentVersionNum [UIDevice currentDevice].systemVersion.doubleValue #endif /* FWSystemMacro_h */