Home > DeveloperSection > Forums > Objective C allow to allocate object through alloc and init
Jessica James
Jessica James

Total Post:16

Posted on    August-18-2015 11:48 PM

 iPhone iPhone  Ios  Objective C 

 0 Reply(s)
 734  View(s)
Rate this:

What is the difference between the following 2 ways to allocate and init an object?

AController *tempAController = [[AController alloc] init];

self.aController = tempAController;

[tempAController release];


self.aController= [[AController alloc] init];

Most of the apple example use the first method. Why would you allocate, init and object and then release immediately?

Don't want to miss updates? Please click the below button!

Follow MindStick