Given two UIViewControllers A and B. A sits on top of a UINavigationController. B has init function initWithArray. B was made and initWithArray in A. Then B was pushed into the NavigationController to sit on top of A.
In A, this is the array that was passed in
NSArray *arrayInA; //(assuming all init and everything was done)
Making B
B *b = [[B alloc]initWithArray: arrayInA];
[self.navigationController pushViewController: B animation: YES];
In B, initWithArray goes something like this
if (self){
arrayInB = arrayFromA;
}
arrayInB is just private property in B
NSArray *arrayInB;
The question is, which of these are different objects? arrayInA / arrayFromA / arrayInB
Edit: I am working with ARC.
In your code arrayInB points to the same memory address as arrayFromA which points to arrayInA. I would suggest changing your code so that arrayInB keeps a reference to the array it receives.
or
If you want arrayInB to be its own array that points to the same objects as arrayFromA then you should do this.