UINavigationController with 3 tables
I am creating an app that us开发者_StackOverflow中文版es a navigation controller. In the the first view I have three different table views.
How can I make the tables open a new view in the navigation controller when one cell is selected?
Thanks
You implement tableView:didSelectRowAtIndexPath:
as a delegate method on the view controller that shows the three table views, and in this method you initialize the new view controller you want to show and push it onto the screen by doing something like this:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// TODO: Find out what view controller to push based on the tableView and the indexPath.
UIViewController *viewController = [[YourSpecialViewController alloc] initWithNibName:nil bundle:nil];
[[self navigationController] pushViewController:viewController animated:YES];
[viewController release];
}
精彩评论