If you want to “click” another view controller, your table view controller must be built into the UINavigationController. Then there are two ways to handle clicking a new view controller when selecting a row:
(iOS < 5.0) , -tableView:didSelectRowAtIndexPath: ( ). , , indexPath, , , , . :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController *nextVC;
if (indexPath.section == 0) {
nextVC = [[ProfileController alloc] init];
} else {
nextVC = [[LocationController alloc] init];
}
[self.navigationController pushViewController:nextVC animated:YES];
}
(iOS 5.0+) - IB -prepareForSegue:sender:... . . -tableView:didSelectRowAtIndexPath:, , performSegueWithIdentifier: , . :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0) {
[self peformSegueWithIdentifier:@"showProfile"];
} else {
[self peformSegueWithIdentifier:@"showLocation"];
}
}
, , -prepareForSegue:sender:.
UIWebViewController... , UIWebView.