单击TableViewCell时,我可以将View更改为ViewController吗?

时间:2014-04-11 11:21:51

标签: ios objective-c

我是Objective-C的新手。

TableViewCell上有TableViewViewController,如下图所示。

enter image description here

点击Viewcontroller时,我想将视图更改为其他TableViewCell

但似乎无法使用performSegueWithIdentifier更改View中的didSelectRowAtIndexPath而不使用UINavigationController,错误日志如下所示:

Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

当我点击Viewcontroller时,还有其他方法可以将视图更改为其他TableViewCell吗?

提前致谢。

2 个答案:

答案 0 :(得分:1)

U可以使用此

显示视图控制器
 -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
    yourViewController *vc = [[yourViewController alloc]initWithNibName:@"yourViewController" bundle:[NSBundle mainBundle] ];  
        [self presentViewController:vc animated:YES completion:nil];

    }

答案 1 :(得分:1)

在Interface Builder(故事板)中,单击以下内容:

enter image description here

调试器说的正是:Push segues can only be used when the source controller is managed by an instance of UINavigationController.'然后你就可以推送segues了。