ios - How Memory allocated without calling alloc - NSArray,NSString -
i have 2 viewcontroller:
viewcontroller1 - has property nsarray array1 , in viewdidload assigning self.array1 = @[@"a",@"b",@"c",@"d"];
question 1 : how without coding alloc, array1 allocated memory , storing values?
question 2 : have viewcontroller2 - has property nsarray array2
using prepareforseque method, assigning array1 value array2,
[[segue destinationviewcontroller] setarray2:self.array1]; in viewcontroller2 - viewdidload if log array2 getting value. got array2 memory allocated?
its called syntactic sugar, compiler allocates needed memory. array2 pointer. assign memory address of allocated memory of array1
you can here examples
ios iphone objective-c
No comments:
Post a Comment