Randolph Levant
Randolph Levant

Reputation: 229

Create a sort of navigation logic within an application: how to?

I have a number of view controllers that I want to navigate; however, I need to implement an intuitive way to move to previous ones. For the button press methods in my view controller custom classes to move forward, I do something like this:

NextViewController *next = [self.storyboard instantiateViewControllerWithId:@"NextViewController"];
[self presentModalViewController:next animated;YES]; 

With this in mind, how can I return back to previous views?

Upvotes: 0

Views: 106

Answers (2)

Lance
Lance

Reputation: 9012

When using modals you simply add a button that links to the action:

-(void)goBack:(id)sender {
    [self dismissModalViewControllerAnimated:YES];
}

Upvotes: 0

nduplessis
nduplessis

Reputation: 12436

Why not just use the built in UINavigationController? You can hide the navigation bar and use custom controls to push and pop controllers as you wish

Upvotes: 1

Related Questions