Files
peko-ios/YuMi/Global/YUMIMacroUitls.h

76 lines
2.6 KiB
C
Raw Normal View History

2023-07-06 16:54:13 +08:00
//
// YMMacro.h
// YUMI
//
// Created by YUMI on 2021/9/10.
//
///一些宏
#import "NSBundle+Localizable.h"
2023-07-06 16:54:13 +08:00
#ifndef YUMIMacroUitls_h
#define YUMIMacroUitls_h
2023-07-14 18:50:55 +08:00
//iPhoneX系列设备(刘海屏设备)
2023-07-06 16:54:13 +08:00
#define iPhoneXSeries \
({BOOL isPhoneXSeries = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneXSeries = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneXSeries);})
#define KScreenWidth [[UIScreen mainScreen] bounds].size.width
#define KScreenHeight [[UIScreen mainScreen] bounds].size.height
2023-10-31 11:09:04 +08:00
#define statusbarHeight [[UIApplication sharedApplication] statusBarFrame].size.height
2023-07-06 16:54:13 +08:00
#define kStatusBarHeight statusbarHeight
2023-10-31 11:09:04 +08:00
#define kSafeAreaBottomHeight (iPhoneXSeries ? 34 : 0)
#define kSafeAreaTopHeight (iPhoneXSeries ? 24 : 0)
#define kNavigationHeight (kStatusBarHeight + 44)
#define kTabBarHeight (iPhoneXSeries ? 49.0+34.0 : 49.0)
2023-07-06 16:54:13 +08:00
#define kScreenScale ((CGFloat)KScreenWidth / (CGFloat)375)
#define kScreenHeightScale ((CGFloat)KScreenHeight / (CGFloat)812)
#define kHalfScreenHeight KScreenHeight * 0.65
#define kGetScaleWidth(width) kRoundValue(width)
#define kRoundValue(value) round(kScreenScale * value)
#define kScreenHeightScale ((CGFloat)KScreenHeight / (CGFloat)812)
#define kWeakify(o) try{}@finally{} __weak typeof(o) o##Weak = o;
#define kStrongify(o) autoreleasepool{} __strong typeof(o) o = o##Weak;
2023-07-14 18:50:55 +08:00
///keyWindow
#define kWindow [UIApplication sharedApplication].keyWindow
#define kImage(image) [UIImage imageNamed:image]
///UIFont
#define kFontRegular(font) [UIFont systemFontOfSize:kGetScaleWidth(font) weight:UIFontWeightRegular]
#define kFontMedium(font) [UIFont systemFontOfSize:kGetScaleWidth(font) weight:UIFontWeightMedium]
#define kFontSemibold(font) [UIFont systemFontOfSize:kGetScaleWidth(font) weight:UIFontWeightSemibold]
#define kFontBold(font) [UIFont systemFontOfSize:kGetScaleWidth(font) weight:UIFontWeightBold]
#define kFontHeavy(font) [UIFont systemFontOfSize:kGetScaleWidth(font) weight:UIFontWeightHeavy]
2023-07-06 16:54:13 +08:00
2023-11-09 15:26:14 +08:00
///内置版本号
2024-04-24 20:08:24 +08:00
#define PI_App_Version @"1.0.3"
2023-11-09 15:26:14 +08:00
///渠道
2023-11-03 11:19:14 +08:00
#define PI_App_Source @"appstore"
//#define PI_App_Source @"pi_tf"
2023-11-09 15:26:14 +08:00
///正式环境
2023-07-06 16:54:13 +08:00
#define API_HOST_URL @"https://api.hfighting.com"
2024-04-24 20:08:24 +08:00
//#define API_HOST_URL @"https://api.molistar.xyz"
2023-11-09 15:26:14 +08:00
///测试环境
2024-04-12 15:55:09 +08:00
#define API_HOST_TEST_URL @"http://beta.api.molistar.xyz"
2023-07-06 16:54:13 +08:00
#define API_Image_URL @"https://image.hfighting.com"
2023-07-14 18:50:55 +08:00
#define YMLocalizedString(key) \
[NSBundle ymLocalizedStringForKey:(key)]
2024-04-11 17:05:27 +08:00
#define isMSRTL() [[NSBundle getLanguageText] hasPrefix:@"ar"]
///是否是中文
#define isMSZH() [[NSBundle getLanguageText] hasPrefix:@"zh"]
///是否是英文
#define isMSEN() [[NSBundle getLanguageText] hasPrefix:@"en"]
2023-07-14 18:50:55 +08:00
#endif /* YUMIMacroUitls_h */