How to use NSArray of NSArray object in objective c?

Posted by user1306926 on Stack Overflow See other posts from Stack Overflow or by user1306926
Published on 2012-04-02T09:49:40Z Indexed on 2012/04/02 11:29 UTC
Read the original article Hit count: 254

Filed under:
|

I declared a NSArray object in .h file as

@property (nonatomic, assign) NSArray  *scnArray;

and in .h file under - (void)viewDidLoad I created three different NSArray objects as

NSArray  *obj1 = [[NSArray alloc] initWithObjects:@"1",@"0",@"0",nil];
NSArray  *obj2 = [[NSArray alloc] initWithObjects:@"0",@"3",@"0",nil];
NSArray  *obj3 = [[NSArray alloc] initWithObjects:@"0",@"0",@"5",nil];

scnArray = [[NSArray alloc] initWithArray:obj1];
[scnArray arrayByAddingObjectsFromArray:obj2];
[scnArray arrayByAddingObjectsFromArray:obj3];

and if I access this scnArray from any other function

NSArray *caseArray = [scnArray objectAtIndex:index];//index will be 0, 1, 2...

I am getting BAD_ACCESS_ERROR. What is the problem here and how can I correct to use it?

© Stack Overflow or respective owner

Related posts about ios

Related posts about xcode