1
votes

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.

1
Please help me right statement change for pushViewController that it use in UITableViewControllerCuong Nguyen
Your question is hard to understand.achi

1 Answers

1
votes

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.