user403015
user403015

Reputation: 7227

How can I dismiss a pushViewController in iPhone/iPad?

I need to make a button to dismiss the child view controller from a pushViewController. The action is exactly like the left (back) button on the top navigation bar.

How can I dismiss a pushViewController? Which method should I use ?

Thanks.

Upvotes: 9

Views: 9038

Answers (2)

doruvil
doruvil

Reputation: 93

In my case where [self performSegueWithIdentifier:@"showAllContacts" sender:self]; pushes a new ViewController, in order to close(dismiss) that view controller which has been pushed I use:

[self.navigationController popViewControllerAnimated:YES];

This is called for a custom button which I added to the navigation bar!

Upvotes: 7

Jacob Relkin
Jacob Relkin

Reputation: 163238

UINavigationController's popViewControllerAnimated: method should do it.

Upvotes: 15

Related Questions