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

Popular posts from this blog

Integrating ZXing QR Code reader in iPhone / iOS applications

Multiple line of text in UIPickerView

Connect Samsung devices to Kies on Mac