Ios 单击TableViewCell时是否可以将视图更改为ViewController?
我不熟悉Objective-C 它有Ios 单击TableViewCell时是否可以将视图更改为ViewController?,ios,objective-c,Ios,Objective C,我不熟悉Objective-C 它有TableViewCell和ViewController上的TableView,如下图所示 单击TableViewCell时,我想将视图更改为另一个Viewcontroller 但是,如果不使用UINavigationController,则似乎无法使用performsguewithidentifier更改中的视图,错误日志如下所示: Push segues can only be used when the source controller is man
TableViewCell
和ViewController
上的TableView
,如下图所示
单击TableViewCell
时,我想将视图更改为另一个Viewcontroller
但是,如果不使用UINavigationController
,则似乎无法使用performsguewithidentifier
更改中的视图
,错误日志如下所示:
Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
当我点击表格视图单元格
时,是否有其他方法将视图更改为另一个视图控制器
提前感谢。您可以使用此
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
yourViewController *vc = [[yourViewController alloc]initWithNibName:@"yourViewController" bundle:[NSBundle mainBundle] ];
[self presentViewController:vc animated:YES completion:nil];
}
在界面生成器(情节提要)中,单击以下内容:
Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
正是调试器所说的:Push segues只能在源控制器由UINavigationController的实例管理时使用。
然后您就可以推送segues了。在yourViewController*vc=[[yourViewController alloc]initWithNibName:@“yourViewController”处出现了错误Expected identifier
bundle:[NSBundle mainBundle]]代码>。您知道错误发生的原因吗?#导入“yourViewController”