// // Constants.h // SDKDemo // // Created by Tim Lei on 10/13/15. // Copyright © 2015 FreeView. All rights reserved. // #import //#import "NSBundle+HDLEZ.h" // 日志输出 #ifdef DEBUG #define HDLEZLog(fmt, ...) NSLog((@"- HDLEZSDK: " fmt), ##__VA_ARGS__) #else #define HDLEZLog(...) #endif //国际化语言 #define HDLEZLocallizedString(x, ...) NSLocalizedString(x, nil) /* Default Font Name */ #define HDLEZ_App_Default_Font_Name @"Helvetica Neue" /* NavigationBar Style */ #define HDLEZ_NavigationBar_Bar_Tint_Color [UIColor colorWithHex:0x3C6DD2 alpha:1.0] #define HDLEZ_NavigationBar_Tint_Color [UIColor colorWithHex:0xFFFFFF alpha:1.0] #define HDLEZ_NavigationBar_Foreground_Color [UIColor colorWithHex:0xFFFFFF alpha:1.0] #define HDLEZ_NavigationBar_Title_Shadow_Color [UIColor colorWithHex:0x0 alpha:1.0] #define HDLEZ_NavigationBar_Title_Font_Size 18.0 #define HDLEZ_APP_SCREEN_BOUNDS [[UIScreen mainScreen] bounds] #define HDLEZ_IPhoneX ([UIApplication sharedApplication].statusBarFrame.size.height >= 44) #define HDLEZ_APP_SCREEN_HEIGHT (HDLEZ_APP_SCREEN_BOUNDS.size.height) #define HDLEZ_APP_SCREEN_WIDTH (HDLEZ_APP_SCREEN_BOUNDS.size.width) #define HDLEZ_APP_TOP_BAR_HEIGHT (HDLEZ_IPhoneX ? 88 : 64) #define HDLEZ_APP_STATUS_BAR_HEIGHT (HDLEZ_IPhoneX ? 44 : 20) #define HDLEZ_APP_TAB_BOTTOM_HEIGHT (HDLEZ_IPhoneX ? 34 : 0) #define HDLEZHEXCOLOR(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 HDLEZRGBCOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255 green:(g)/255 blue:(b)/255 alpha:a] // Design Width&Height #define HDLEZDesignWidth 375 #define HDLEZDesignHeight 667 #define HDLEZGetRealWidth(W) W / (HDLEZDesignWidth * 1.0f / APP_SCREEN_WIDTH) #define HDLEZGetRealHeight(H) H / (HDLEZDesignHeight * 1.0f / APP_SCREEN_HEIGHT) // 字体颜色* #define HDLEZ_COLOR_TITLE_BLACK HDLEZHEXCOLOR(0x1B2D4D,1.0) #define HDLEZ_COLOR_TEXT HDLEZHEXCOLOR(0x333333,1.0) #define HDLEZ_COLOR_TEXT_HIGLIGHT HDLEZHEXCOLOR(0xFB744A,1.0) #define HDLEZ_COLOR_TEXT_WHITE HDLEZHEXCOLOR(0xFFFFFF,1.0) #define HDLEZ_COLOR_TEXT_ORANGE HDLEZHEXCOLOR(0xFC744B,1.0) #define HDLEZ_COLOR_TEXT_GRAY HDLEZHEXCOLOR(0x666666,1.0) #define HDLEZ_COLOR_TEXT_LIGHT_GRAY HDLEZHEXCOLOR(0xC0C7D4,1.0) #define HDLEZ_COLOR_TEXT_DETAIL_GRAY HDLEZHEXCOLOR(0x999999,1.0) #define HDLEZ_COLOR_TEXT_LIGHT_BLUE HDLEZHEXCOLOR(0x4484F4,1.0) #define HDLEZ_COLOR_TEXT_TITLE_GRAY HDLEZHEXCOLOR(0x1B2D4D,1.0) #define HDLEZ_COLOR_TEXT_INPUT_GRAY HDLEZHEXCOLOR(0xA5AEBC,1.0) #define HDLEZ_COLOR_TEXT_INPUT_PLACEHOLD_GRAY HDLEZHEXCOLOR(0xC0C7D4,1.0) #define HDLEZ_COLOR_TEXT_BUTTON_GRAY HDLEZHEXCOLOR(0x798394,1.0) //背景颜色 #define HDLEZ_COLOR_NAV_BACKGROUND HDLEZHEXCOLOR(0xF7F7F7,1.0) //导航栏背景颜色 #define HDLEZ_COLOR_VIEW_BACKGROUND HDLEZHEXCOLOR(0xF2F3F7,1.0) //后视图背景颜色 #define HDLEZ_COLOR_VIEW_FOREGROUND HDLEZHEXCOLOR(0xFFFFFF,1.0) //前视图背景颜色 #define HDLEZ_COLOR_BACKGROUND_GRAY HDLEZHEXCOLOR(0x000000,0.4) //灰色背景颜色 #define HDLEZ_COLOR_BACKGROUND_BLACK HDLEZHEXCOLOR(0x232323,1.0) //黑色背景颜色 #define HDLEZ_COLOR_BACKGROUND_ORANGE HDLEZHEXCOLOR(0xFC744B,1.0) //橙色背景颜色 #define HDLEZ_COLOR_BACKGROUND_IMAGE HDLEZHEXCOLOR(0xE9E9E9,1.0) //图片背景颜色 #define HDLEZ_COLOR_BACKGROUND_BUTTON HDLEZHEXCOLOR(0x4484F4,1.0) //按钮背景颜色 #define HDLEZ_COLOR_BACKGROUND_BUTTON_GRAY HDLEZHEXCOLOR(0xC0C7D4,1.0) //按钮灰背景颜色 #define HDLEZ_COLOR_BACKGROUND_LINE HDLEZHEXCOLOR(0xECEDEE,1.0) //下划线背景颜色 #define HDLEZ_COLOR_BACKGROUND_LINE_RED HDLEZHEXCOLOR(0xFF5757,1.0) //线背景红颜色 //字体大小 #define HDLEZ_FontSize_15 15 // 小标题字号 15 #define HDLEZ_FontSize_16 16 // 小标题字号 16 #define HDLEZ_FontSize_12 12 // 小标题字号 12 #define HDLEZ_FontSize_10 10 // 小标题字号 10 #define HDLEZ_FontSize_14 14 // 小标题字号 14 #define HDLEZ_FontSize_24 24 // 小标题字号 24 #define HDLEZ_FontSize_18 18 // 小标题字号 18 #define HDLEZ_FontSize_26 26 // 小标题字号 26 #define HDLEZ_APP_UIFont @"PingFangSC-Regular"//苹方-简 常规体 #define HDLEZ_APP_UIFont_BOLD @"PingFangSC-Semibold"//苹方-简 中粗体 #define HDLEZ_APP_UIFont_Medium @"PingFangSC-Medium"//苹方-简 中黑体 #define HDLEZ_Get_FontMediumWithSize(s) [UIFont fontWithName:HDLEZ_APP_UIFont_Medium size:s] #define HDLEZ_Get_FontRegularWithSize(s) [UIFont fontWithName:HDLEZ_APP_UIFont size:s] #define HDLEZ_Get_FontBoldWithSize(s) [UIFont fontWithName:HDLEZ_APP_UIFont_BOLD size:s] // 创建临时密码通知 #define HDLEZNotificationChangeTemP @"hdlEZNotificationChangeTemP" //// 人脸信息变化通知事件d //#define HDLEZNotificationChangeFace @"hdlNotificationChangeFace" // //// 通话结束通知 //#define HDLF_FV_NF_END_CALL @"hdlNotificationEndCall" // //// 通话开始通知 //#define HDLF_FV_NF_BEGIN_CALL @"hdlNotificationBeginCall" // // //// 通话类型 //#define HDLF_FV_CALL_TYPE_KEY @"HDLEZCallTypeKey" //萤石门锁spk #define HDLEZ_DOOR_SPK @"security.door.ezviz" //设备类型 typedef enum { HDLEZDeviceType_Default=0, //默认类型 HDLEZDeviceType_Door=1,//门锁 }HDLEZDeviceType; @interface HDLEZConstants : NSObject /*获取当前controller */ +(UIViewController *)currentVC; /*获取当前window */ +(UIWindow*)appWindow; /*截图 */ +(UIImage *)captureImageFromView:(UIView *)view; /*保存图片到相册 */ +(void)saveImageToPhotosAlbum:(UIImage *)savedImage; /** * 生成二维码 */ + (UIImage *)creatCIQRCodeImage:(NSString *)dataStr; /*获取特定时间格式的时间字符串 */ +(NSString *)timeStrWithFormate:(NSString *)formate data:(NSDate *)date; /** 计算文字高度,允许换行计算 @param fontSize 文字大小 @param widht 文字宽度 @param text 文字内容 @return 返回文字的高度 */ +(CGFloat)sizeLineFeedWithFont:(CGFloat)fontSize textSizeWidht:(CGFloat)widht text:(NSString*)text; /** * 保存数据 */ + (void)saveObject:(id )obj key:(NSString*)key; /** * 获取数据 */ + (id)getObjectBykey:(NSString*)key; /*小于两位数前面自动填补0 */ +(NSString *)autoFillZero:(NSInteger)value; /*时间对比 */ + (int)compareOneDay:(NSDate *)oneDay withAnotherDay:(NSDate *)anotherDay; /*时间格式转换 */ +(NSString *)turnDateString:(NSString*)dateString toFormater:(NSString*)formater; /*判断是否为纯数字 @param number 内容 */ +(BOOL)validateNumber:(NSString*)number; /* 将nil转为"" */ +(NSString*)turnNil:(NSString *)str; @end