如何关闭使用pushViewController方法呈现的视图?
我的情况如下:
1)我有 rootViewController 和 navigationController 并在工具栏中添加按钮。当我按下时,我使用 PushViewController 方法推送另一个视图。这个视图称为 ChooseTypeView,它只有带有两个单元格的表格视图。
2)当单击任何单元格时,将使用相同的方法推送第三个视图以输入一些数据。
3)现在我希望当我按下键盘中的“完成”按钮时导航回 rootView 控制器并关闭当前步骤和根视图之间的所有视图。
我正在使用 @Protocol 来连接视图,我可以将信息从最后一个视图传递到根视图,但我无法忽略它。
谢谢大家,我希望我能说清楚。
my situation is as follow:
1) i have rootViewController with navigationController and add button in the toolbar. When i press i push another view using pushViewController method. This view called chooseTypeView which has only tableview with two cells.
2) when any cell is clicked third view will be pushed using the same method to enter some data.
3) now i want when i press the "Done" button in the keyboard to navigate back to rootView controller and dismiss all views in between the current steps and the root view.
i'm using @Protocol to connect views and i could pass information from the last view to the root view but i couldn't dismiss it.
Thanks for all and i hope that i make myself clear.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我可以自己回答这个问题。
在委托方法中,我可以调用
[self.navigationController popViewControllerAnimated:YES]
,这将从 navigationController 视图堆栈中删除当前视图。I could answer this question my self.
In the delegate method i can call
[self.navigationController popViewControllerAnimated:YES]
which will remove the current view from navigationController views stack.对于 SWIFT,请使用以下代码:
For SWIFT use the below code: