#pragma mark -NSUserDefaults
#define NSUserDefaults [NSUserDefaults standardUserDefaults]
#define Synchronize [NSUserDefaults synchronize]
#define NSUserDefaults_BoolForKey(_KEY_) [NSUserDefaults boolForKey:_KEY_]
#define NSUserDefaults_ObjectForKey(_KEY_) [NSUserDefaults objectForKey:_KEY_]
#define NSUserDefaults_SetBoolForKey(_BOOL_, _KEY_) [NSUserDefaults setBool:_BOOL_ forKey:_KEY_]
#define NSUserDefaults_SetObjectForKey(_OBJECT_, _KEY_) [NSUserDefaults setObject:_OBJECT_ forKey:_KEY_]
#pragma mark -Keys for NSUserDefaults
#define VERSION_THELAST_EXISTS @"Version_370_Exists"
#pragma mark -Device Size
#define NavigationBar_HEIGHT 44
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#define SCREEN_BOUNDS [[UIScreen mainScreen]bounds]
#pragma mark -CGMake
#define Point(x,y) CGPointMake(x, y)
#define Size(w,h) CGSizeMake(w, h)
#define Rect(x,y,w,h) CGRectMake(x,y,w,h)
#pragma mark -NSLog
#ifdef DEBUG
# define NSLog(fmt, ...) NSLog((fmt),##__VA_ARGS__)
#else
# define NSLog(...)
#endif
#pragma mark -Return NSObject
#define String(fmt, ...) [NSString stringWithFormat:(fmt),##__VA_ARGS__]
#define URL(fmt, ...) [NSURL URLWithString:String((fmt),##__VA_ARGS__)]
#define IMG(name) [UIImage imageNamed:name]
#define COLOR(color) [UIColor color]
#pragma mark - File functions
#define PATH_OF_APP_HOME NSHomeDirectory()
#define PATH_OF_TEMP NSTemporaryDirectory()
#define PATH_OF_DOCUMENT [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]
iOS 常用的宏
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...