UINavigationController : pop and push view controller iOS

Mr.Javed Multani
1 min readOct 3, 2020

Popping in a Navigation Controller

To previous view controller

To pop back to the previous page you can do this: Swift


Objective C

[self.navigationController popViewControllerAnimated:YES];

To root view controller

To pop to the root of the navigation stack, you can do this: Swift


Objective C

[self.navigationController popToRootViewControllerAnimated:YES];

Pushing a view controller onto the navigation stack


let fooViewController = UIViewController()
navigationController?.pushViewController(fooViewController, animated: true)

Objective C

UIViewController *fooViewController = [[UIViewController alloc] init];
[navigationController pushViewController:fooViewController animated:YES];
Mr.Javed Multani

Software Engineer | Certified ScrumMaster® (CSM) | UX Researcher | Youtuber | Tech Writer