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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:23:45+00:00 2026-05-20T07:23:45+00:00

When my iPhone app receives a memory warning the views of UIViewControllers that are

  • 0

When my iPhone app receives a memory warning the views of UIViewControllers that are not currently visible get unloaded. In one particular controller unloading the view and the outlets is rather fatal.

I’m looking for a way to prevent this view from being unloaded. I find this behavior rather stupid – I have a cache mechanism, so when a memory warning comes – I unload myself tons of data and I free enough memory, but I definitely need this view untouched.

I see UIViewController has a method unloadViewIfReloadable, which gets called when the memory warning comes. Does anybody know how to tell Cocoa Touch that my view is not reloadable?

Any other suggestions how to prevent my view from being unloaded on memory warning?

Thanks in advance


Apple docs about the view life cycle of a view controller says:

didReceiveMemoryWarning – The default
implementation releases the view only
if it determines that it is safe to do
so

Now … I override the didReceiveMemoryWarning with an empty function which just calls NSLog to let me know a warning was received. However – the view gets unloaded anyway. Plus, on what criteria exactly is decided whether a view is safe to unload … oh ! so many questions!

  • 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-20T07:23:46+00:00Added an answer on May 20, 2026 at 7:23 am

    What appears to be working for me was to override setView: to ignore setting to nil. It’s kludgy, but then, this is a kludgy issue, and this did the trick:

    -(void)setView:(UIView*)view {
        if(view != nil || self.okayToUnloadView) {
            [super setView:view];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an iPhone game which receives memory warning that I am
I'm trying to debug an issue that only occurs when my iPhone app receives
The iPhone app that I am working on requires GET calls to a 3rd
I have an iPhone app that is currently using the test environment for iAds.
i am developing an iphone app that receive data from sql server through php
My iPhone app can't seem to use soft keyboards that doesn't use the US-like
My iPhone app generally uses under 5MB of living memory and even in the
The iPhone app that I released is a wireless game controller, it translates touches
We have an app in the appstore that works without any issues on iPhone
i use instruments to track my app's usage of memory,in memory monitor,i find that

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.