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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:16:47+00:00 2026-05-16T11:16:47+00:00

I have a view controller (view A) presenting a modal view (B) when the

  • 0

I have a view controller (view A) presenting a modal view (B) when the user pushed a button and the view B has itself a button to present view C. My problem is that if the user exits the application when the view B or C is shown, the same view will appear next time the application is launched. Is there a way to dismiss the views B and C on exit or to show view A when the application starts?
Thanks for your help

  • 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-16T11:16:48+00:00Added an answer on May 16, 2026 at 11:16 am

    I assume by close you mean when the application enters the background.

    In your app delegate you can via the applicationDidEnterBackground: method dismiss your controller.

    Best way would probably be to add an observer in your view controller class:

    - (void) viewDidLoad {
        [super viewDidLoad];
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appClosing) name:@"appClosing" object:nil];
    }
    
    - (void) dealloc
    {
        [[NSNotificationCenter defaultCenter] removeObserver:self name:@"appClosing" object:nil];
        [super dealloc];
    }
    
    - (void) appClosing
    {
        [self dismissModalViewControllerAnimated:YES];
    }
    

    And post the notification in your app delegate:

    - (void)applicationDidEnterBackground:(UIApplication *)application
    {
         [[NSNotificationCenter defaultCenter] postNotificationName:@"appClosing" object:nil];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a modal view controller that I am presenting on iPad via: vc.modalPresentationStyle
I have a view controller class that has to implement several protocols. Too keep
I am presenting a modal view controller to show detailed information. I have it
I have a tab bar application and when I display a modal view controller,
I have a view controller and I am presenting it modal, as in... UIViewController
I have a modal view controller which is crashing when it dismisses itself. The
I have a modal view that comes up requiring the user to verify his/her
i have view controller which contains a button which show the image library ,if
I have a view controller based app that contains several views that I display/hide
I have a view controller that houses a UIWebView. I want to display an

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.