UITableView中点击不同Cell跳转到不同的View

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row % 2 == 0) {
        ViewControllerOne *oneController = [[self storyboard]instantiateViewControllerWithIdentifier:@"ViewOne"];
        [[self navigationController] pushViewController:oneController animated:YES];
    } else {
        ViewControllerTwo *twoController = [[self storyboard]instantiateViewControllerWithIdentifier:@"ViewTwo"];
        [[self navigationController] pushViewController:twoController animated:YES];
    }
}

你可能感兴趣的:(IOS,Development)