75 lines
2.7 KiB
C
75 lines
2.7 KiB
C
//
|
|
// QXDefine.h
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2025/4/25.
|
|
//
|
|
|
|
///safe底部
|
|
#define kSafeAreaBottom KEYWINDOW.safeAreaInsets.bottom
|
|
///safe高
|
|
#define kSafeAreaTop KEYWINDOW.safeAreaInsets.top
|
|
///状态栏高度
|
|
//#define StatusHeight kSafeAreaTop + 20
|
|
///导航高度 + safe高
|
|
#define NavContentHeight (kSafeAreaTop + NavHeight)
|
|
///称号高
|
|
#define UserIconHeight 16
|
|
/// 称号宽
|
|
#define UserIconWidth 42
|
|
///导航高
|
|
#define NavHeight 44
|
|
///工具栏高度
|
|
#define TabbarHeight 50
|
|
#define TabbarContentHeight (kSafeAreaBottom + TabbarHeight)
|
|
/// keywindow
|
|
#define KEYWINDOW \
|
|
^(){\
|
|
UIWindow*keyWindow = nil;\
|
|
NSArray *windows = [UIApplication sharedApplication].windows;\
|
|
for (UIWindow *window in windows){\
|
|
if(window.isKeyWindow){\
|
|
keyWindow = window;\
|
|
break;\
|
|
}\
|
|
}\
|
|
return keyWindow;\
|
|
}()
|
|
|
|
//设置RGB颜色/设置RGBA颜色
|
|
#define RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
|
|
#define RGBA(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(r)/255.0 blue:(r)/255.0 alpha:a]
|
|
#define RGB16(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
|
|
#define RGB16A(rgbValue, a) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]
|
|
|
|
//国际化
|
|
#define QXText(key) \
|
|
[NSBundle.mainBundle localizedStringForKey:(key) value:@"" table:nil]
|
|
|
|
//适配的宽
|
|
#define ScaleWidth(value) ((value)/375.0f*[UIScreen mainScreen].bounds.size.width)
|
|
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
|
|
|
|
//适配的高
|
|
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
|
|
#define ScaleHeight(value) ((value)/667.0f*[UIScreen mainScreen].bounds.size.height)
|
|
|
|
#define showToast(value) [QXProjectTools showMessage:(value)];
|
|
|
|
#define showToastInView(value,value2) [QXProjectTools showMessage:(value) view:(value2)];
|
|
|
|
#define showLoadingInView(value) [QXProjectTools showLoadingInView:(value)];
|
|
|
|
#define hideLoadingInView(value) [QXProjectTools hideLoadingInView:(value)];
|
|
|
|
#define MAIN_WINDOW [UIApplication sharedApplication].keyWindow
|
|
|
|
#define CheckString(string) (string != nil && ![string isKindOfClass:[NSNull class]] && string.length > 0&& ![string isEqualToString:@"<null>"]&&![string isEqualToString:@"(null)"])
|
|
|
|
#if DEBUG
|
|
#define QXLOG(fmt,...) printf("\n***************%s:%d***************\n%s\n**********************end**********************\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]);
|
|
#else
|
|
#define QXLOG(fmt,...) do{}while(0);
|
|
#endif
|
|
/* QXDefine_h */
|