Friday, August 24, 2012

initwitharray VS arrayWithObjects


InitWith Object Syntax:
NSArray *bar = [[NSArray alloc] initWithObjects:@"hai",@"how",@"are",@"you",nil];
Array With Objects Syntax:
NSArray *tempArray = [NSArray arrayWithObjects:@"hai",@"how",@"are",@"you",nil];

Result= return [[[NSArray alloc] initWithObjects:@"hai",@"how",@"are",@"you",nil] autorelease]
So here the array returned is auto-released. Thats the only difference. 

No comments:

Post a Comment