Reputation: 1394
I have a rootView controller in the UINavigationController with the NSMutableArray. I need to pass the array copy to another ViewController without a permit to change.
So I do the following in the some ViewController:
- (void)setArrExercises:(NSArray *) arrExercs {
// arrExercs NSMutableArray of my custom objects from rootViewController
arrExec = [[NSArray alloc] initWithArray:arrExercs];
}
Array is created, but in the TableView delegate method:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [arrExec count];
}
Theres is no items.
Upvotes: 1
Views: 443
Reputation: 10755
Maybe you must try in this way
-(void) setArrExercises:(NSArray *) arrExercs {
// arrExercs NSMutableArray of my custom objects from rootViewController
NSArray* arrExec = [[NSArray alloc]init];
for( int i=0; i<[arrExercs count]; ++i )
[arrExec addObject:arrExec[i]];
}
Upvotes: 1