Andrew
Andrew

Reputation: 16051

Go back 1 step in navigationbar?

I want a button to have the same effect that pressing the back button in the navigation would have, where the view goes back to the last view.

How do i do this?

Upvotes: 1

Views: 620

Answers (1)

mvds
mvds

Reputation: 47064

Add a method to your view controller:

-(IBAction)goBack:(id)sender
{
     [self.navigationController popViewControllerAnimated:YES];
}

And add the button in IB, hook up the touchupInside event to the newly added goBack: method you just added.

Upvotes: 4

Related Questions