宏定义

1.颜色
颜色宏定义
#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define RGB(r,g,b) RGBA(r,g,b,1.0f)

#define HEXCOLOR(hex) [UIColor colorWithRed:((float)((hex & 0xFF0000) >> 16)) / 255.0 green:((float)((hex & 0xFF00) >> 8)) / 255.0 blue:((float)(hex & 0xFF)) / 255.0 alpha:1]

#define COLOR_RGB(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)]

2.根据屏幕宽度

#define judgeScreenW(Plus,Phone5,Phone6)  ((ScreenW > 375.0) ? (Plus) : (((ScreenW < 375.0) ? (Phone5) : (Phone6))));
3.其他
//状态栏高度  
#define STATUS_BAR_HEIGHT 20  
//NavBar高度  
#define NAVIGATION_BAR_HEIGHT 44  

//屏幕 rect  
#define SCREEN_RECT ([UIScreen mainScreen].bounds)  
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)  
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)  
#define CONTENT_HEIGHT (SCREEN_HEIGHT - NAVIGATION_BAR_HEIGHT - STATUS_BAR_HEIGHT)  
  
//屏幕分辨率  
#define SCREEN_RESOLUTION (SCREEN_WIDTH * SCREEN_HEIGHT * ([UIScreen mainScreen].scale))  
 

你可能感兴趣的:(宏定义)