views:

95

answers:

0

I'm trying to build a Drill down tableview to show the information that I have in a hierachy of arrays and classes. I have 3 classes:

class Video { nameVideo, id, description, user... }  
class Topic {nameTopic, topicID, NSMutableArray videos; }  
class Category {nameCategory, categoryID, NSMUtableArray topics}  

   //AppDelegate.h
 NSMutableArray categories;

The app display the tableView with nameCategory, but then, when I select a row it shows a tableview with 0 rows. If I check, for the second view the NumberOfRowsInSection, it returns me 0. I supose that the error is that I don't build correctly the provisional array called tableDataSource, I don't know the reason why it doesn't copy the new information on this array. `

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.tableDataSource count];    //--> On the second view it is 0!
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

    Category *aCategory = [self.tableDataSource objectAtIndex:indexPath.row];

            navegaTableViewController *nvController = [[navegaTableViewController alloc] initWithNibName:@"navegaTableView" bundle:[NSBundle mainBundle]];

            nvController.CurrentLevel += 1;
            nvController.CurrentTitle = @"Topic"; 
            nvController.tableDataSource = aCategory.topics; 

            [self.navigationController pushViewController:nvController animated:YES];
            [nvController release];
}