单例
-EnGirl开发经验分享
.h文件
@interfaceCommonProperties :NSObject
+(CommonProperties*)shareProperties;
.m文件
#import"CommonProperties.h"
@implementationCommonProperties
staticCommonProperties*commonProperties =nil;
+ (CommonProperties*)shareProperties
{
staticdispatch_once_tonceToken;
dispatch_once(&onceToken, ^{
commonProperties= [[superallocWithZone:NULL]init];
});
returncommonProperties;
}
+ (id)allocWithZone:(struct_NSZone*)zone
{
return[CommonPropertiesshareProperties];
}
- (id)init
{
self= [superinit];
if(self) {
}
return self;
}
@end