[英]Cancel button in Navigation View not working
code for cancel button is
取消按钮的代码是
- (IBAction)cancelButton:(id)sender {
[self dismissViewControllerAnimated:YES completion:nil];
}
While tracing the program I can see the method is called however the view is not dissmissing to the previous view controller. 在跟踪程序时,我可以看到该方法被调用了,但是视图并没有移交给先前的视图控制器。
if you use Navigation View controller you should use 如果您使用Navigation View控制器,则应使用
[self.navigationController popViewControllerAnimated:YES];
instead of dismissViewControllerAnimated 而不是dismissViewControllerAnimated
PS actually, I think you use storyboards and segues and in this case you should use UnwindSegue What are Unwind segues for and how do you use them? PS:实际上,我认为您使用情节提要和脚本,在这种情况下,您应该使用UnwindSegue。Unwindsegue的作用是什么?如何使用它们? Also you should read some common documentation about in app navigation...
另外,您还应该阅读一些有关应用程序导航的常见文档...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.