// 单例
#define DECLARE_SHARED_INSTANCE(className) \
+ (className *)sharedInstance; #define IMPLEMENT_SHARED_INSTANCE(className) \
+ (className *)sharedInstance { \
static className *sharedInstance = nil; \
@synchronized(self) { \
if (!sharedInstance) { \
sharedInstance = [[[self class] alloc] init]; \
} \
} \
return sharedInstance; \
}