Breaking News
Home / iOS / ObjectiveC / Singleton Example in Objective C?

Singleton Example in Objective C?

Solution

static MyManager *sharedManager = nil;

+(MyManager*) sharedManager
{
        if (sharedManager == nil)
        {
                sharedManager = [[MyManager alloc] init];        

        }
        return sharedManager;
}[pb_builder]

Check Also

How to print NSDictionary in Objective C?

Solution NSDictionary *dict = nil; dict = [NSDictionary dictionaryWithObject: @"1" forKey: @"one"]; // method 1 for(NSString *key in dict) {    NSLog(@”key : %@”,key);  …

Advertisment ad adsense adlogger