If you want to "push" another review controller, your table view controller should be embedded in a UINavigationController. Then, there's two ways to handle pushing a new view controller when a row is selected:
Without storyboards (iOS < 5.0), your best opportunity to do things is when -tableView:didSelectRowAtIndexPath:
is called on your table view's delegate (typically the table view controller). From there, you can choose where to go based on the indexPath
that was passed in, create an instance of the view controller you want to go to, and push it onto the navigation controller. For example:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController *nextVC;
if (indexPath.section == 0) {
nextVC = [[ProfileController alloc] init];
// configure nextVC as needed
} else {
nextVC = [[LocationController alloc] init];
// configure nextVC as needed
}
[self.navigationController pushViewController:nextVC animated:YES];
}
With storyboards (iOS 5.0+), the normal way to do things is to drag a segue in IB from the table cell to the next view controller, and implement your logic to configure the destination view controller based on the selection in -prepareForSegue:sender:
... but you can't drag multiple segues from the same table cell. Instead, drag segues from the view controller itself, and give them identifiers. Make your choice in -tableView:didSelectRowAtIndexPath:
as before, but call performSegueWithIdentifier:
instead of creating the destination view controller yourself. For example:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) {
[self peformSegueWithIdentifier:@"showProfile"];
} else {
[self peformSegueWithIdentifier:@"showLocation"];
}
}
If you need to configure the destination view controller based on which table row was tapped, do that in -prepareForSegue:sender:
.
There's no UIWebViewController... but this would be the same regardless of whether one of your view controllers managed a UIWebView.