如何通过push segue关闭一个viewController与storyboard?
我不知道为什么dismissViewControllerAnimated:completion:
。我只是想做到这一点。如何通过push segue关闭一个viewController与storyboard?
我开始与
[self performSegueWithIdentifier:@"my_segue" sender:self];
但就是我所说的解聘除没有任何反应。我可以创建另一个Segue,但它会创建一个新的视图控制器。
我的问题是:如何解雇performSegueWithIdentifier:sender:
?
[my_segue_view_controller dismissModalViewControllerAnimated: YES]
?
(不知道,但它的作品在我的实践)
performSegueWithIdentifier:sender:
本身没有被驳回,这只是这就是所谓发起了一个名为赛格瑞的方法。在赛会发生什么更有趣。
你说的没错,你应该叫dismissViewControllerAnimated:completion:
,应该由呈现视图控制器,它以前叫被称为使用presentViewController:animated:completion:
呈现视图控制器。有关更多信息,请参见the UIViewcontroller docs。
你有一个的导航栏在那的viewController的呼唤:
[self performSegueWithIdentifier:@"my_segue" sender:self];
如果是这样,你需要使用:
[self.navigationController popViewControllerAnimated:YES];
至弹出堆栈的视图。还有一个赛格瑞的电话,但该框架似乎拨打:
presentViewController:animated:completion:
或:
pushViewController:animated:
适当。
雷
我正在尝试以dismissViewController为中心的不同组合。我很高兴地发现,并且尝试了你的'popViewController'建议。不知道这是否属实,但我可以肯定地看到PUSH segue和互惠POP需求之间可能存在的关系。 – BonanzaDriver 2014-02-19 21:33:12
你可以只调用
[self dismissViewControllerAnimated:YES completion:nil];
从视图控制器,因为视图控制器被SEGUE推。
您应该避免使用'dismissModalViewControllerAnimated:',因为[docs](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html)表示它是弃用。应该使用'dismissViewControllerAnimated:completion:'代替。 – 2012-04-23 06:28:23