我是Objective-C的新手。
TableViewCell
上有TableView
和ViewController
,如下图所示。
点击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
吗?
提前致谢。
答案 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(故事板)中,单击以下内容:
调试器说的正是:Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
然后你就可以推送segues了。