Cuong Nguyen
Cuong Nguyen

Reputation: 990

Process UITableViewController with didSelectRowAtIndexPath

I have problem with tableView:didSelectRowAtIndexPath:.

 (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    /*if (!self.detailViewController) {
        self.detailViewController = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
    }
    NSObject *object = [_objects objectAtIndex:indexPath.row];
    self.detailViewController.detailItem = object;
    [self.navigationController pushViewController:self.detailViewController animated:YES];*/

if (!self.travelViewController) { self.travelViewController = [[TravelViewController alloc] initWithNibName:@"TravelViewController" bundle:nil]; } [self.navigationController pushViewController:self.travelViewController animated:YES]; }

pushViewController use in UIViewController but travelViewController inherits from UITableViewController.

Upvotes: 1

Views: 167

Answers (1)

mackworth
mackworth

Reputation: 5953

Well, I'll give it a shot, despite the lack of a question. I assume that you're using the generic code which is commented out, and changed it to the second version.

If so, it looks fine, except that you haven't given the travelViewController any information about which "travel" to show. Usually, didSelectRow is called when the user taps on a row, indicating that they want to interact with that particular row.

Upvotes: 1

Related Questions