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

  • Home
  • SEARCH
  • 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 8092717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:20:46+00:00 2026-06-05T20:20:46+00:00

In my navigation stack, I have 2 viewcontrollers, which were pushed to the navigation

  • 0

In my navigation stack, I have 2 viewcontrollers, which were pushed to the navigation stack. Over that I have a PresentModalViewController as rootviewcontroller and I push 2 more viewcontrollers over it. So the navigation stack will be like

ViewController

ViewController

PresentModalViewController as rootviewcontroller

ViewController

ViewController

From the topmost viewcontroller, on a button click, I would like to move to the bottommost viewcontroller. The viewcontrollers in between should be popped or dismissed. How is it possible.
I have tried dismissModalViewControllerAnimated: and popToRootViewControllerAnimated: without any success.

  • 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-06-05T20:20:47+00:00Added an answer on June 5, 2026 at 8:20 pm

    Used delegates to solve this problem.

    Class A.h
    @protocol MyDelegateClass
    - (void)didLoadHomeView; 
    
    
    Class B.h
    @interface MyViewController : UIViewController<MyHomeViewDelegate>
    
    Class B.m
    - (void)didLoadHomeView
    {
        [self.navigationController popToRootViewControllerAnimated:YES];
    }
    
    Class C.h
    @interface MyCurrentViewController : UIViewController
    {
        id <MyLoadHomeDelegate> homeDelegate; 
    }
        @property (nonatomic,assign) id <MyLoadHomeDelegate>   homeDelegate;
    
    Class C.m
    -(IBAction) OnHome:(id)sender{
        [self dismissModalViewControllerAnimated:NO];
        if (self.homeDelegate) {
            [homeDelegate didLoadHomeView];
        }
    

    }

    The ModalViewController, which is the current RootViewController is dismissed in the OnHome:(id)sender method in MyCurrentVIewController class. After dismissing the ModalViewController, I popped to the current rootviewcontroller in the navigation stack, which is the home view(firstViewController). The above code works perfectly in my case.

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

Sidebar

Related Questions

I have a UIViewController that is popped from the navigation stack on iPhone and
I have a UITableView (on a navigation controller stack) which is showing details for
I have several viewControllers controlled by a navigation controller. For example, viewController A and
I have 5 view controllers(say A,B,C,D,E) in my navigation stack. ViewController E is in
I have ViewControllers A and B on the navigation stack. A does not support
I have a navigation controller that displays viewcontroller A. There is a right button
I have a basic navigation stack: NavController->UITableViewController (as rootViewController in the NavController) -> menu
I have a screen with a webView in my navigation controller stack and when
Can I view the contents of the navigation stack? Will I be able to
I'm writing a Navigation-Based iPhone app, and I'd like to have a UIToolBar docked

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.