Skip to content

Instantly share code, notes, and snippets.

@sbrocket
Created September 12, 2008 20:10
Show Gist options
  • Save sbrocket/10508 to your computer and use it in GitHub Desktop.
Save sbrocket/10508 to your computer and use it in GitHub Desktop.
static OptionsViewController *OVCSharedInstance;
+(OptionsViewController*)sharedController {
if (!OVCSharedInstance) {
OVCSharedInstance = [[OptionsViewController alloc] initWithStyle:UITableViewStyleGrouped];
NSAssert(OVCSharedInstance!=nil,@"Didn't allocate singleton.");
}
return OVCSharedInstance;
}
+(id)allocWithZone:(NSZone*)zone {
NSAssert(OVCSharedInstance==nil,@"Attempted to allocate a second instance of a singleton.");
return [super allocWithZone:zone];
}
-(id)retain {
return self;
}
-(UINT)retainCount {
return UINTMax;
}
-(void)release {
}
-(id)autorelease {
return self;
}
-(id)copyWithZone:(NSZone*)zone {
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment