Monday, May 9, 2011

Objectice C: Change data of NSarray

NSMutableArray *tableContent = [[NSMutableArray alloc] initWithObjects:
                    [NSMutableArray arrayWithObjects:@"a",@"b",@"c",nil],
                    [NSMutableArray arrayWithObjects:@"d",@"e",@"f",nil],
                    [NSMutableArray arrayWithObjects:@"g",@"h",@"i",nil],
                     nil];

[[tableContent objectAtIndex:0] replaceObjectAtIndex:1 withObject:@"new object"];

Source:
http://stackoverflow.com/questions/2088679/objective-c-accessing-changing-array-elements-in-a-multidimensional-array-nsar

No comments: