// // Constants.h // Yoosee // // Created by guojunyi on 14-3-21. // Copyright (c) 2014年 guojunyi. All rights reserved. // #ifndef LOG_ON #define LOG_OFF #endif #ifdef LOG_ON # define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); #else # define DLog(...) #endif #define SECOND (1) #define MINUTE (60 * SECOND) #define HOUR (60 * MINUTE) #define DAY (24 * HOUR) #define MONTH (30 * DAY) #define YEAR (12 * MONTH) //** 简单的property 定义 #define Strong @property(nonatomic, strong) #define Weak @property(nonatomic, weak) #define Retain @property(nonatomic, retain) #define Copy @property(nonatomic, copy) #define Assign @property(nonatomic, assign) #define APP_VERSION @"00.46.02.03" #define BundleVersion @"bundleVersion"//系统版本号3.0 #define kDeviceToken @"device_token" #define is_Bind_DeviceToken @"is_Bind_DeviceToken" #define kToken @"user_token" #define kVersion @"version" #define kUsername @"user_name"//用户名 #define kNikename @"nike_name"//昵称 #define Cache_Message @"Cache_Message" #define Noti_WillEnterForeground @"noti_willEnterForeground" //当前版本号 #define Version_Code [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] //当前bundle版本号 #define Bundle_Code [[[NSBundle mainBundle]infoDictionary] objectForKey:@"CFBundleVersion"] #define XBgColor [UIColor colorWithRed:224.0/255.0 green:224.0/255.0 blue:224.0/255.0 alpha:1.0] #define XHeadBarBgColor [UIColor colorWithRed:10.0/255.0 green:10.0/255.0 blue:10.0/255.0 alpha:1.0] #define XHeadBarTextColor [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0] #define XHeadBarTextSize (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 24.0:18.0) #define customRedCorlor [UIColor colorWithRed:217.0/255.0 green:80.0/255.0 blue:80.0/255.0 alpha:1] #define WEAK_SELF __weak typeof(self) weakSelf = self // 4.屏幕大小尺寸 #define screen_width [UIScreen mainScreen].bounds.size.width #define screen_height [UIScreen mainScreen].bounds.size.height //UI设计尺寸,在开发过程中需要用此方法转换 #define kSizeFrom750(x) ((x) * ([UIScreen mainScreen].bounds.size.width/750.f)) #define SYSTEMSIZE(x) [UIFont systemFontOfSize:kSizeFrom750(x)] #define FontSize(x) [UIFont systemFontOfSize:x] //设置图片 #define IMAGEBYENAME(name) [UIImage imageNamed:name] //alloc #define InitObject(vc) [[vc alloc]init] #define RECT( a, b, c, d) CGRectMake(a, b, c, d) //#define UIColorFromRGB(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 UIColorFromRGB_A(rgbValue,alphaValue) [UIColor \ colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue] //#define UIColorFromRGBA(rgbValue) [UIColor \ colorWithRed:((float)((rgbValue & 0xFF000000) >> 24))/255.0 \ green:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \ blue:((float)((rgbValue & 0xFF00) >> 8))/255.0 \ alpha:((float)(rgbValue & 0xFF))/255.0] #define XBlack [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0] #define XBlack_128 [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:128.0/255.0] #define XBlue [UIColor colorWithRed:101.0/255.0 green:181.0/255.0 blue:250.0/255.0 alpha:1.0] #define XWhite [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0] #define XBGAlpha [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.0] #define XFontBold_18 (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? [UIFont boldSystemFontOfSize:20.0]:[UIFont boldSystemFontOfSize:18.0]) #define XFontBold_16 (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? [UIFont boldSystemFontOfSize:16.0]:[UIFont boldSystemFontOfSize:14.0]) #define XFontBold_14 (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? [UIFont boldSystemFontOfSize:14.0]:[UIFont boldSystemFontOfSize:12.0]) #define XFontBold_12 (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? [UIFont boldSystemFontOfSize:12.0]:[UIFont boldSystemFontOfSize:10.0]) //global #define CURRENT_VERSION [[[UIDevice currentDevice] systemVersion] floatValue] #define IOS7 [[[UIDevice currentDevice] systemVersion] floatValue]>=7 #define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width #define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height #define TAB_BAR_HEIGHT 49 #define NAVIGATION_BAR_HEIGHT ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0 ? (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 44:44):(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 64:64)) //#define NAVIGATION_BAR_HEIGHT ([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0 ? (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 64:44):(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 64:64)) #define NavigationBarHeight (self.navigationController.navigationBar.frame.size.height+[[UIApplication sharedApplication] statusBarFrame].size.height) //TABLE TEXTFIELD #define BAR_BUTTON_HEIGHT (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 68:46) #define BAR_BUTTON_LEFT_ICON_WIDTH_AND_HEIGHT (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 36:24) #define BAR_BUTTON_RIGHT_ICON_WIDTH_AND_HEIGHT (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 24:18) #define BAR_BUTTON_MARGIN_LEFT_AND_RIGHT (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 25:15) #define TEXT_FIELD_HEIGHT (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 60:40) //BUTTON #define NORMAL_BUTTON_MARGIN_LEFT_AND_RIGHT (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 45:35) //storage type #define SDCARD 16 #define USB 0 /* *1. 设计要大小为20*20像素的view; *2. view的大小为(20/SCREEN_SCALE)*(20/SCREEN_SCALE)点的view。 */ #define SCREEN_SCALE [[UIScreen mainScreen] scale] //1像素的大小 #define ONE_PIXEL_SIZE (1.0/[[UIScreen mainScreen] scale]) /* *1. 1英寸 = 96 px; *2. 1英寸 = 72 pt; */ #define FondSizeWithPxValue(PxValue) ((PxValue/96.0)*72.0) /** 校验字符串是否为空 */ #define IsEmptyStr(str) (str==nil||[str isEqualToString:@""]||[str isEqualToString:@""]||[str isEqualToString:@"nil"]||[str isEqualToString:@"(null)"]) //国际化字体定义 #define InternationalizationFondSize(FondSizeString) [UIFont systemFontOfSize:[FondSizeString floatValue]] #define InternationalizationBoldFondSize(FondSizeString) [UIFont boldSystemFontOfSize:[FondSizeString floatValue]] #define WiredNetworkAddButtonTag 2016+10+14 #define WifiAddButtonTag 2016+10+14+1 #define WiredNetworkAddButtonNextTag 2016+10+14+2 #define WifiAddButtonNextTag 2016+10+14+3 typedef enum{ P2PCALL_TYPE_MONITOR, P2PCALL_TYPE_VIDEO, P2PCALL_TYPE_PLAYBACK } P2PCallType; typedef enum{ P2PCALL_STATUS_NONE, P2PCALL_STATUS_CALLING, P2PCALL_STATUS_READY_P2P, } P2PCallState; typedef enum{ PLAYBACK_STATE_STOP, PLAYBACK_STATE_PAUSE, PLAYBACK_STATE_PLAYING } GWPlaybackState; typedef struct DeviceDate{ int year; int month; int day; int hour; int minute; }DeviceDate; typedef enum{ NO_CONNECTED_WIFI, NO_WIFI_PASSWORD }TipsType; //16.10.18 typedef NS_ENUM(NSUInteger, SmartDeviceType) { /////摄像头 DEVICECAMERA = 1, /// 水箱 DEVICEAQUARIUM , /// 加热 DEVICEHEATING, DEVICEPETS }; typedef NS_ENUM(NSUInteger, ConnectType) { ///腾讯airkiss ConnectTypeAirKiss = 1, /// 智能配网 ConnectTypeSmartConfig , /// 热点配网 ConnectTypeAP }; #define Ali_Push_APPKey @"26007228" #define Ali_Push_APPSecret @"87c9206424399968ba11a56a9a979cfe" #define GW_APP_ID @"74238b2d4362821cda80379fdf50518c" #define GW_APP_TOKEN @"826aadf87286bf357560b2c1a189c688e1ada4c149f48821d3cadf959a932cdd"