iOS UINavigationController Popping in a Navigation Controller

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

To previous view controller

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

Swift

navigationController?.popViewControllerAnimated(true)

Objective-C

[self.navigationController popViewControllerAnimated:YES];

To root view controller

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

Swift

navigationController?.popToRootViewControllerAnimated(true)

Objective C

[self.navigationController popToRootViewControllerAnimated:YES];


Got any iOS Question?