开发者

How to dismiss a view that is presented with pushViewController method?

开发者 https://www.devze.com 2023-02-21 03:55 出处:网络
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 cho

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"开发者_StackOverflow 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.


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.


For SWIFT use the below code:

 self.navigationController.popViewControllerAnimated(true)
0

精彩评论

暂无评论...
验证码 换一张
取 消