单例的全部实现
static Singleton *sharedSingleton = nil;
+(Singleton *)sharedInstance{ if (sharedSingleton == nil) { sharedSingleton = [[super allocWithZone:NULL] init]; } return sharedSingleton; } +(id)allocWithZone:(NSZone *)zone { return [[self sharedInstance] retain]; } -(id)copyWithZone:(NSZone *)zone { return self; } -(id)retain { return self; } -(NSUInteger)retainCount { return NSUIntegerMax;//表示此对象不能释放 } //下面的oneway也是多线程操作,记住 -(oneway void)release{ //do nothing } -(id)autorelease { return self; }