Oscar
Oscar

Reputation: 1929

Dismiss some views

First, sorry about my English, I know it's bad, but I'm trying to make it better... Here is the issue: I'm making an app, with a view controller, with a lot of views... I want to make a button to go back to the main one. I think I have to dismiss the views I pushed. I dont know if that is necessary or if I can push it again directly. If it is, how can I do that? I've tried to put a dismiss method after the presentModalViewController one, but it didn't work. Any help? Thank you so much for your help ;)

Upvotes: 1

Views: 261

Answers (2)

SirNod
SirNod

Reputation: 781

To present and dismiss a modal view you'll have to use delegation.

Here is an explanation for how to present and dismiss modal views.

Modal views are handled differently than views controlled by the UINavigationController or UITabBarController, which just push them onto a view stack or array of views.

Upvotes: 0

NWCoder
NWCoder

Reputation: 5266

It hard to tell from your question, but you may be confused by the navigation stack and the modal controllers.

A modal controller gets presented and dismissed using:

presentModalViewController:animated:
dismissModalViewControllerAnimated:

Navigation controllers are pushed and popped using:

pushViewController:animated:
popViewControllerAnimated:

So make sure you are using the correct method to pop or dismiss the view in question.

Upvotes: 1

Related Questions