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 8780485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:03:42+00:00 2026-06-13T20:03:42+00:00

I have a view hierarchy like this: MainView -> SubView (PresentingView) -> ModalViewc (all

  • 0

I have a view hierarchy like this:
MainView -> SubView (PresentingView) -> ModalViewc (all subclasses of UIViewController)

By clicking a button in the ModalView I want to remove both the ModalView and the PresentingView so I can return to the MainView which will then present ModalViewX:

MainView -> ModalViewX (all subclasses of UIViewController)

[[self presentingViewController] removeFromParentViewController];

The above code simply dismisses the ModalView but the PresentingView remains.

My final goal is to have the ModalView button perform some concluding logic before returning to the MainView. Clicking the button would basically do the following actions:

  1. Concluding logic
  2. Remove self(ModalView) and PresentingView (bonuspoints if I can animate the removal)
  3. Tell MainView to present ModalViewX
    (maybe I will have to call step 3 in the ModalView -> viewDidUnload method somehow)

Suggestions for how to do this?

  • 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-13T20:03:43+00:00Added an answer on June 13, 2026 at 8:03 pm

    First, embed your whole project in a UINavigationController with the MainViewController as the rootview. To get from the MainViewController to the SubViewController do this:

    - (IBAction) theButtonClicked : (id) sender {
        SubViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"YourIdentifier"];
        [self.navigationController pushViewController:vc animated:YES];
    }
    

    This will get you to the next UIViewController. If you want to pass information, just set vc setVariable:.

    To get back to the rootview, simply call [self.navigationController popToRootViewControllerAnimated:YES]

    The other way is to use segues, where you CTRL+drag from the button to the next UIViewController. The logic to be done should then be set in the method - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender, where the destionationcontroller is segue.destinationViewController.

    That way, you can also add your custom animation by setting the seguestyle to custom, and subclassing UISegue.

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

Sidebar

Related Questions

I have a view hierarchy that looks something like this: UIView (A) UIView >
So, I have this view hierarchy in my app: UIWindow UIViewController UITabBarController -> 4
I have a view hierarchy like this: nav1 (UINavigationController, top level object in nib)
My application supports all orientations except PortraitUpsideDown. In my view hierarchy I have an
I would like to have a view (Hierarchy structure) under Navigation Controller (the top
I have a view controller called vc0 which is presented like this: [self presentViewController:
I'd like to have a view appear when the user clicks a button. The
I have the following view hierarchy setup in my program. Window +ContentView (Subview of
I've got my View hierarchy set up like this. UITabBarController | UINavigationController | |
I have my main window's content view set like this: newContentView = [[CutoutView alloc]initWithFrame:window.frame];

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.