Object allocate and init in Objective C

Posted by Ronnie Liew on Stack Overflow See other posts from Stack Overflow or by Ronnie Liew
Published on 2008-10-01T04:31:43Z Indexed on 2010/04/07 19:13 UTC
Read the original article Hit count: 340

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];

and

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?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa