self.tableView indexPathForSelectedRow返回nil

时间:2015-01-10 20:56:15

标签: objective-c uitableview

我对Objective-C很新,遇到了以下问题。

我已经设置了故事板并相应地链接了视图控制器。另外,设置segue。但是,由于一些奇怪的原因,self.tableView indexPathForSelectedRow正在归还nil

非常感谢先进的帮助!

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.

    if([[segue identifier] isEqualToString:@"infoTherapyCloseCase"])
    {
        infoTherapyPhaseCloseCaseViewController *info = [segue destinationViewController];

        //info = [segue destinationViewController];
        NSIndexPath *myIndexPath = [self.tableView indexPathForSelectedRow]; 
        int row = [myIndexPath row];

        TherapyPhases *tp = _DetailModal[row];

        info.DetailModal = @[tp];
    }
}

0 个答案:

没有答案