繁体   English   中英

从没有UINavigationController和后退按钮的推送视图返回,可以吗?

[英]Coming back from a push view without a UINavigationController and a back button, is it possible?

我有一个ViewController ,例如startingScreenViewController 我有一个从该视图上的项目到另一个视图( someViewController )的推送服务,该视图是其中具有TableView (当然不是TableViewController )的ViewController 现在,我没有后退按钮,而是想通过单击表视图中的单元格返回到第一个视图。 我已经写了我的细胞代表:

-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
}

我尝试使用

[self.navigationController popViewControllerAnimated:YES];

显然它没有用,因为我没有navigationController 我甚至想Segue公司回startingScreenViewController这是做愚蠢的事,也没有工作。

我需要一些帮助,建议将不胜感激。

我不知道如何在不使用UINavigationController情况下通过push segue打开someViewController ,但是如果someViewController ,请尝试使用以下代码:

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
   [self dismissViewControllerAnimated:YES completion:nil];
}

而且,当然,检查是您的table view view controller delegate

简短的答案是,当您没有导航控制器时,不要使用推送功能。 那根本不起作用,而且它确实起作用是一个意外。 无法保证它将在将来继续工作。

使用模态的presentViewController:animated:completion调用,使用相应的调用将其关闭。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM