Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 826977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:30:02+00:00 2026-05-15T03:30:02+00:00

I have a long View Controllers hierarchy; in the first View Controller I use

  • 0

I have a long View Controllers hierarchy;

in the first View Controller I use this code:

SecondViewController *svc = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[self presentModalViewController:svc animated:YES];    
[svc release];

In the second View Controller I use this code:

ThirdViewController *tvc = [[ThirdViewController alloc] initWithNibName:@"ThirdViewController" bundle:nil];
[self presentModalViewController:tvc animated:YES];    
[tvc release];

and so on.

So there is a moment when I have many View Controllers and I need to come back to the first View Controller.
If I come back one step at once, I use in every View Controller this code:

[self dismissModalViewControllerAnimated:YES];

If I want to go back directly from the, say, sixth View Controller to the first one, what I have to do to dismiss all the Controllers at once?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:30:03+00:00Added an answer on May 15, 2026 at 3:30 am

    I found the solution.

    Of course you can find the solution in the most obvious place so reading from the UIViewController reference for the dismissModalViewControllerAnimated method …

    If you present several modal view
    controllers in succession, and thus
    build a stack of modal view
    controllers, calling this method on a
    view controller lower in the stack
    dismisses its immediate child view
    controller and all view controllers
    above that child on the stack. When
    this happens, only the top-most view
    is dismissed in an animated fashion;
    any intermediate view controllers are
    simply removed from the stack. The
    top-most view is dismissed using its
    modal transition style, which may
    differ from the styles used by other
    view controllers lower in the stack.

    so it’s enough to call the dismissModalViewControllerAnimated on the target View.
    I used the following code:

    [[[[[self parentViewController] parentViewController] parentViewController] parentViewController] dismissModalViewControllerAnimated:YES];
    

    to go back to my home.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom view: public class Loading extends View { private long movieStart;
In my application,i have text view with long text. i need text wrapping like
A have a view controller, and it creates a downloader object, which has a
I have defined: a view at views/pages/about.html.rb , a test in spec/controllers/pages_controller_spec.rb : describe
i have problem to pass data from view to controller , i have view
I have a view controller that i'm trying to push onto the navigation stack.
I have been trying to play around with this for a long time and
I've been banging my head against this for too long. I have two ViewControllers
In one of my view controllers, i have a lot of different formats for
i have programmatically created a tab bar and added 7 view controllers to it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.