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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:39:30+00:00 2026-05-24T06:39:30+00:00

I am using 3 UIViewControllers in my app and now I am wondering if

  • 0

I am using 3 UIViewControllers in my app and now I am wondering if it is a good idea to release them when I switch from to another. Obviously, it would be the hidden ones which I really dont need them while they are not visible…
to switch views, I’m using something like this (uiwindow):

//this is in the first UIViewController
[[[UIApplication sharedApplication] keyWindow] addSubview:secondController.view];
[self.view removeFromSuperview];
//here I release the view controller
[self release];

So my question…it’s that really worth it? what could be the performance issues?

Also, I would like to ask if someone knows why these lines work in this order (see below). I tried the other way around and I have problems with the orientation which stopped to work? any hints?

//working
[[[UIApplication sharedApplication] keyWindow] addSubview:secondController.view];
[self.view removeFromSuperview];

//not working
[self.view removeFromSuperview];
[[[UIApplication sharedApplication] keyWindow] addSubview:secondController.view];

Thanks

Raul

  • 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-24T06:39:31+00:00Added an answer on May 24, 2026 at 6:39 am

    … it’s that really worth it? what could be the performance issues?

    You can very well release a view controller once you added it as subview of another view(a superView), in which case the superView retains the subview. [[UIApplication sharedApplication] keyWindow] is the superView of secondController.view and it retains secondController.view. So, that is a correct way to do it and it won’t cause any performance issues.

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

Sidebar

Related Questions

I went through guide from Apple Your first iOS app and now I have
I am using a UINavigationBar in my app with three different UIViewControllers. The RootViewController
In an iPad app, I'm using a custom subclass of UIView with UIViewController. Here's
I've developed an app using xcode 4.2 and storyboard and yesterday when I tried
I'm using UISplitViewController for app on iPad. The first task was to show master
I just started building an app using X-Code 4.2. I created the app with
I am using Apple's MuiltipleDetailViewController sample app and get the message UIViewController may not
When testing my app using Instruments -> Activity Monitor, I'm seeing a difference in
I'm currently using the iOS 5 SDK trying to develop my app. I'm trying
I am working on a Universal app & would like to access the values

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.