OBJECTIVE C ALLOW TO ALLOCATE OBJECT THROUGH ALLOC AND INIT

Jessica James

Total Post:16

Points:114
Posted by  Jessica James
 800  View(s)
Ratings:
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];

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?

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!