NSArrays in NSArrays. A pointer problem?
Posted
by RyJ
on Stack Overflow
See other posts from Stack Overflow
or by RyJ
Published on 2010-03-30T23:08:30Z
Indexed on
2010/03/30
23:13 UTC
Read the original article
Hit count: 485
I believe my problem involves pointers, a concept I often struggle with, but here's what I'm trying to do.
I have six NSArrays. I want an additional NSArray comprised of these six arrays, so:
self.arr1 = [NSArray array];
self.arr2 = [NSArray array];
self.arr3 = [NSArray array];
self.arr4 = [NSArray array];
self.arr5 = [NSArray array];
self.arr6 = [NSArray array];
NSArray *containerArray = [[NSArray alloc] initWithObjects:self.arr1, ... etc, nil];
Whenever I update one of the first 6 NSArrays, I want the object updated in containerArray. (I know I'm using an NSArray and not an NSMutableArray, when I update the arrays I create a new one and assign it to the instance variable).
Currently, any manipulation of arr1 is not reflected in [containerArray objectAtIndex:0].
© Stack Overflow or respective owner