/*
* 单例定义宏
*/
//* 单例interface
#define CLASS_SINGLETON_INTERFACE(classname) \
@interface classname : NSObject \
+ (classname *)share##classname;
//* 单例implementation
#define CLASS_SINGLETON_IMPLEMENTATION(classname) \
static classname* shared##classname = nil; \
@implementation classname \
+ (classname *)share##classname \
{ \
@synchronized(self) \
{ \
if (shared##classname == nil) \
{ \
shared##classname = [[self alloc] init]; \
} \
} \
return shared##classname; \
}