Pushing to a UITable inside a UIView from a UITableview

Posted by Michael Robinson on Stack Overflow See other posts from Stack Overflow or by Michael Robinson
Published on 2010-06-17T16:31:11Z Indexed on 2010/06/17 17:53 UTC
Read the original article Hit count: 381

I can firgure out how to push a UIView from a Tableview and have the "child" details appear.

Here is the view I'm trying to load:

alt text

Here is the code that checks for children and either pushes a itemDetail.xib or an additional UITable, I want to use the above .xib but load the correct contents "tableDataSource" into the UItable:

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

//Get the dictionary of the selected data source.
NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];

//Get the children of the present item.
NSArray *Children = [dictionary objectForKey:@"Children"];

if([Children count] == 0) {

    ItemDetailViewController *dvController = [[ItemDetailViewController alloc] initWithNibName:@"ItemDetailView" bundle:[NSBundle mainBundle]];
    [self.navigationController pushViewController:dvController animated:YES];
    [dvController release];
}
else {

    //Prepare to tableview.
    FirstTab *rvController = [[FirstTab alloc] initWithNibName:@"FirstView" bundle:[NSBundle mainBundle]];

    //Increment the Current View
    rvController.CurrentLevel += 1;

    //Set the title;
    rvController.CurrentTitle = [dictionary objectForKey:@"Title"];

    //Push the new table view on the stack
    [self.navigationController pushViewController:rvController animated:YES];   

    rvController.tableDataSource = Children;

    [rvController release];
}

}

Thanks for the help. I see lots of stuff on this but can't find the correct push instructions.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uitableview