25

I am working on iPhone application which based on navigation controller. for example there are 2 views here.

A (UITableViewController) and B (ViewController)

the quest is here. when user select an item in View A. The application will force navigation controller to hide navigation bar before push View B to be showed, like the statement below:

self.navigationController.navigationBarHidden = YES;
[self.navigationController pushViewController:controllerB animated:TRUE];

That is, View B is there. but How can available user to navigate back to View A without navigation bar? In this case, we will use a button 'back' to let user tap on it to navigate back to View A. Could you help me?

4

3 回答 3

64

您可以调用 popViewControllerAnimated 方法:

[self.navigationController popViewControllerAnimated:YES];
于 2009-09-17T10:45:39.137 回答
0

斯威夫特 3:

 _ = navigationController?.popViewController(animated: true)

来自这篇文章:Xcode 8 / Swift 3:“UIViewController 类型的表达式?未使用”警告

于 2018-04-12T03:15:47.677 回答
0

斯威夫特版本

self.navigationController?.popViewController(animated: true)
于 2018-04-03T10:19:05.937 回答