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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:11:46+00:00 2026-06-11T05:11:46+00:00

I am building an IOS 5.1 web client app that uses a storyboard. One

  • 0

I am building an IOS 5.1 web client app that uses a storyboard. One of my actions is “logout”, during which I want to reset my root view to the initial view created by the root view of the Storyboard. (When you log in, some view items are removed or added based on who you are; when you log out, I want to reset them to their default values, which I’ve specified in the storyboard.)

I realize that I could programmatically reset/re-add all of the elements, but then what good is the storyboard? I figure there’s got to be a way to get back to square one by reloading the view file, right?

  • 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-11T05:11:47+00:00Added an answer on June 11, 2026 at 5:11 am

    I found the following approach works for me. Please note that I use ARC, unsure if this has much bearing on the solution however. First, in the app delegate class, in application:didFinishLaunchingWithOptions: I capture the inital Storyboard instance with the following line of code:

    _initalStoryboard = self.window.rootViewController.storyboard;
    

    (Obviously there is an instance variable UIStoryboard* _initalStoryboard;)

    Then I have the following function defined in my app delegate:

    - (void)resetWindowToInitialView
    {
        for (UIView* view in self.window.subviews)
        {
            [view removeFromSuperview];
        }
    
        UIViewController* initialScene = [_initalStoryboard instantiateInitialViewController];
        self.window.rootViewController = initialScene;
    }
    

    Please note the for in loop which removes all subviews from window. The UIWindow rootViewController documentation states:

    If the window has an existing view hierarchy, the old views are
    removed before the new ones are installed.

    However I did not find this to be the case… so I remove the existing views myself explicitly before assigning a new rootViewController. I have not found any worrying side effects or memory leaks using this method. I am by no means an expert on the magic of UIKit so I would suggest you test test and retest this solution if you plan to use it yourself. Cheers

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

Sidebar

Related Questions

I'm in the progress of building an web-app that syncs with an iOS client.
Some Quick Background I'm building an iOS app that uses html web views in
I'm currently building a web app, which is built with Xcode 3.2.5 and iOS
I am building an assistive iOS app for a kid that uses a switch
I'm building an iOS app to consume a web service that's offered up by
I am writing an app for iOS that uses data provided by a web
I am building an app that uses a async socket connection with a web
When we are building html5 web app or ios hybrid app,we need to make
I am building a ios app for ipad, in which the user will be
We are building a PhoneGap app (both for iOS and Android) that has a

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.