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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T04:20:03+00:00 2026-05-11T04:20:03+00:00

At the beginning of my app, I am initializing a UIViewController with a NIB.

  • 0

At the beginning of my app, I am initializing a UIViewController with a NIB.

At some point, I am removing the view from the screen, then releasing it, so it no longer takes up memory. (At this point I am also saving the state of the view in the UIViewController)

At a later point, I want to recreate the view and bring it back on screen. I will then restore its state. (Using the same UIViewController, not a new one, since it saved the state)

My question, is when I recreate the view, how do I do so from the NIB, or is this not possible?

To me, the obvious remedies are:

  1. Don’t save state in the UIViewcontroller (Where does convention dictate that I do save state?)

  2. Don’t release the view (maybe just release all of its subviews?)

  3. Don’t load my view from a NIB, create programmatically (seems to go against using IB for everything)

Note: I am not using a UINavigationController, I am handling the swapping of the views myself, since thee are only 2 of them.

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T04:20:04+00:00Added an answer on May 11, 2026 at 4:20 am

    If you need that level of control, you dont really want to use IB. Because, as you noted, if remove the view and then later recreate it, you would have to do it in code then anyway. Just design most of the views in IB, then write some code that generates just this view. Then you can call that same method again later to recreate that view when you need it.

    You may be able to archive it and later turn it back into an object, but that seems like an inelgant solution. IB does not allow for dynamic creation of controls at runtime, even if they used to exist but don’t anymore. There is no shame in leaving IB out of loop for this. In fact it’s probably a good idea.


    OR

    If its a complicated view with a lot of pieces, put the view in it’s own nib, and make a view controller for it. Then you can simply instatiate the view controller with the nib name, and add the controllers view as a subview to you main view. Then your view controller handles loading of the nib, and you get to design it in IB. Nothing says the view of a view controller has to take up the entire screen either.

    self.otherController = [[OtherController alloc] initWithNibName:@'Other' bundle:nil]; [self.view addSubview:otherController.view]; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing an app that downloads some information from internet. At the beginning of
We have a database app that we're beginning to write some new systems for
My app has a main screen that the user always starts at, and from
I am developing an app for android where I need some data from a
My App is a view-based application. At the beginning I show my logo and
I'm just beginning Android and have gotten myself stuck. I've made a simple app/view.
At the beginning of my app the user records their voice which is then
At the very beginning of my app I load up some Fragments in tabs.
I am working on an app and released 2 updates previously. From the beginning
I am beginning Facebook App development and am following the Recipe Box App Tutorial

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.