Accessing 2D array and passing string to label.text

Posted by Amir on Stack Overflow See other posts from Stack Overflow or by Amir
Published on 2010-04-29T05:47:23Z Indexed on 2010/04/29 5:57 UTC
Read the original article Hit count: 411

Filed under:
|
|

Hi.

I'm trying to create 2D array and initialize it with NSStrings. When I try to copy content of a cell from the array to a label.text, the application crashes.

NSMutableArray *array = [NSMutableArray arrayWithCapacity:0];

[array addObject:[NSMutableArray arrayWithObjects:
                   [NSArray arrayWithObjects: @"0-0", @"0-1", @"0-2", nil],
                   [NSArray arrayWithObjects: @"1-0", @"1-1", @"1-2", nil],
                   [NSArray arrayWithObjects: @"2-0", @"2-1", @"2-2", nil],
                   nil]];

label.text = [[array objectAtIndex:0] objectAtIndex:0];

Any idea why and what am I doing wrong?

© Stack Overflow or respective owner

Related posts about 2d

Related posts about array