//字符串宏 #define EMPTY_STRING(string) ( [string isKindOfClass:[NSNull class]] || string == nil || [string isEqualToString:@""]) #define GET_STRING(string) (EMPTY_STRING(string) ? @"" : string)
//单例类 #define DECLARE_SINGLETON(cls_name, method_name) + (cls_name*)method_name; #define IMPLEMENT_SINGLETON(cls_name, method_name) + (cls_name *)method_name { static cls_name *method_name; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ method_name = [[cls_name alloc] init]; }); return method_name; } //本地化 #define L(s) NSLocalizedString((s), nil)
时间: 2024-10-12 17:38:42