didSelectRowAtIndex不起作用

时间:2014-02-14 10:51:14

标签: ios uitableview

我正在尝试将url字符串推送到我的Main,当我按下单元格时它会显示我的主视图控制器。

这是我的代码。

 #pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"Index Selected,%d",indexPath.row);

    MainViewController *View = [self.storyboard instantiateViewControllerWithIdentifier:@"main"];

    [self.navigationController modalTransitionStyle];
    NSString *urltoPass = [NSString stringWithString:[[tableData objectAtIndex:indexPath.row]objectForKey:@"cellSubtitle"]];

    View.urlString = [[NSString alloc] initWithFormat:@"http://%@",urltoPass];
    View.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    [myTableView deselectRowAtIndexPath:indexPath animated:YES];

}

1 个答案:

答案 0 :(得分:1)

您需要致电

– presentViewController:animated:completion:
<\ n>在View Controller上显示它。