Singleton static object
To create static shared object, that can be used across all view controllers
.h
+ (id) sharedCustomAppController;
.m
static CustomApplicationController *sharedCustomAppController = nil;
+ (id) sharedCustomAppController
{
@synchronized (self) {
if (sharedCustomAppController == nil) {
sharedCustomAppController = [[CustomApplicationController alloc] init];
}
}
return sharedCustomAppController ;
}
Comments
Post a Comment