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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:56:29+00:00 2026-06-12T22:56:29+00:00

Let me explain. I have multiple UIViewControllers . On my MainPageController , I have

  • 0

Let me explain. I have multiple UIViewControllers. On my MainPageController, I have 3 UIViews. Let’s enumerate it this way: the first UIView is called LoginView, the second is called HomeView and the other one is called RegView. Now in HomeView, there are multiple buttons that will lead to other UIViewControllers. For example, one button will lead to StoreController. Now if I am inside StoreController and I want to go back to MainPageController, I simply call:

[self dismissModalViewControllerAnimated:YES completion:nil]

This will send me back to the HomeView.

That is good. However, inside the StoreController, there are buttons which will supposedly direct me to LoginView or RegView, whichever button was tapped. The problem is when the method [self dismissModalViewControllerAnimated:YES completion:nil], it only take me back to HomeView, no matter which button I pressed.

So how will I display the right UIView once the dismissModalViewControllerAnimated is called?

EDIT:

This is how I show the UIViews:

-(void)viewDidLoad
{
  //Initialize the views here...
}

-(void)showViewByTag:(NSInteger)tag
{
   if (tag == 1)
   {
     [self.view addSubview:loginView];
   }
   else if (tag == 2)
   {
     [self.view addSubview:homeView];
   }
   else
   {
     [self.view addSubview:regView];
   }
}

Now I call the method showViewByTag: somewhere in my code to display the views.

  • 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-12T22:56:30+00:00Added an answer on June 12, 2026 at 10:56 pm

    What you could try and do is following: before calling [self dismissModalViewControllerAnimated:YES completion:nil] (and thus go back to your home view), change the view currently displayed in your MainPageController:

    [(MainPageController*)self.presentingViewController showViewByTag:desiredViewTag];
    [self dismissModalViewControllerAnimated:YES...];
    

    If you are worried at the cast and you foresee that self.presentingViewController might be not of MainPageController type on some occasions, then you can check explicitly for its type:

    if ([self.presentingViewController isKindOf:[MainPageController class]])
        [(MainPageController*)self.presentingViewController showViewByTag:desiredViewTag];
    [self dismissModalViewControllerAnimated:YES...];
    

    For this to compile, MainPageController.h must be imported in your modal controller class.

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

Sidebar

Related Questions

First let me explain that I have this script that should let users enter
this is kind of a strange title, so let me explain: We have a
Let me explain you my situation. I have a base class called Shape, and
First let me explain. I have several addresses on the page that I put
Let me try and explain the scenario: I have a form with multiple items
Let me try to explain this to the best of my ability: I have
let me explain my current situation i have a SharePoint site lets say it
Let me explain what I mean : Let's say we have a menu with
Let me explain best with an example. Say you have node class that can
I have a problem with Facebook. Let me explain what I'm trying to do.

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.