Trinh
Trinh

Reputation: 65

How to CLOSE View Controller

Please help me. I have "View Controller(VC) 1" + button "End" and VC 2 I want to end "VC 1" and Switch to VC2 when I touch a button "End". I tried searching online but only "Switch view"... but SWITCHING isn't ENDING

Upvotes: 0

Views: 7287

Answers (1)

Alex Coplan
Alex Coplan

Reputation: 13371

What do you mean by end a view controller?

If you want to pop it off a navigation controller, you can use

[self.navigationController popViewController];

If you want to forcefully close your app (this will get it rejected) use

exit(0);

EDIT:

Now you have somewhat improved your question, I can tell you that this question provides a good overview on switching views.

The top answer uses code from a book called "Beginning iPhone Development" which I would highly recommend if you are just starting out with iPhone Programming.

Upvotes: 3

Related Questions