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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:20:40+00:00 2026-06-11T11:20:40+00:00

I am coding a game where the user can only play if there is

  • 0

I am coding a game where the user can only play if there is an active internet connection. I want to dismiss all ViewControllers and get back to the login screen if the internet status changes. Here’s the hierarchy:

My App Delegate show the LoginViewController by:

self.window.rootViewController = loginViewController;
[self.window makeKeyAndVisible];

Here the user logs in. While logging in I check for connectivity and handle errors. If login is successful loginViewController presents mainViewController using

[self presentModalViewController:self.mainViewController animated:YES];

Then mainViewController presents other controllers, which can present other controllers and so on. The present and dismiss routine is working properly.

Now, if Reachability status changes, I want to display an alert and force the app to get back to the login screen. I know how to listen for these notification and take actions appropriately. It is well documented 🙂

How do I dismiss all view controllers until I land back in the login screen? Do I need to listen to the notification in all view controllers and dismiss them separately? Is there any way of catching the notification in a parent (like the app delegate) and dismissing all view controllers from there (without holding a reference to all of them beforehand)?

Obviously, I’m not using a navigationController so

[self.navigationController popToRootViewControllerAnimated:NO];

is not possible.

Edit: Alternately, I can dismiss and release everything and start from scratch, like if the application is started new. Is this a better approach? How exactly do I do it?

Thank you.

  • 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-11T11:20:41+00:00Added an answer on June 11, 2026 at 11:20 am

    OK I solved it. Simply calling

    [self dismissModalViewControllerAnimated:NO];
    

    on the loginViewController dismisses main view controller and all controllers above on the stack.

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

Sidebar

Related Questions

I'm coding a board game where there is a bag of possible pieces. Each
I am coding a rhythm game and one of the things I really want
Im coding a small app more or less like a word game. There is
I am coding a game which should start several mini-games when scanning a specific
I'm coding a video game and using MySQL to display an icon showing the
I am coding a text based Java game, I have ran into a few
so i'm coding a tic tac toe game in python 3.2 and i have
Hello im coding a plugin for the game minecraft using Bukkit. Basically when a
I'm coding a guitar hero clone game. It's working nice but in fast computers
I am coding on a simple game and writing the *.xsd file. My Problem

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.