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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:02:24+00:00 2026-06-06T16:02:24+00:00

In one of my UIViewControllers , I have a UITableView , which only has

  • 0

In one of my UIViewControllers, I have a UITableView, which only has two rows and both are always visible on screen. This is a table view historically (another developer did it this way – and I’m not stuck with it). Beause both rows of the table are always visible, when my cellForRowAtIndexPath is called, I create one of the cells from a XIB and store a reference to one of the subviews (UITextView). When I need to get hold of the text from that UITextView, I simply use the local reference. This works fine – most of the times.

In one particular case, I navigate to another UIViewController from this one (using pushViewController:animated). That new view controller uses quite a bit of memory, so internally iOS deallocates the table row from the first view controller (it’s not visible any more, because another view controller is active) – and on my return to the first view controller it simply calls cellForRowAtIndexPath again. When that row gets released, naturally the reference I stored internally is no longer valid – and if I try to use it, the app crashes (“selector sent to deallocated instance”).

My question is: how can I catch when iOS internally releases the table cell so that I could set my reference to nil to be re-assigned at a later time?

  • 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-06T16:02:25+00:00Added an answer on June 6, 2026 at 4:02 pm

    Apparently, the only way I found to deal with this issue is to include

    - (void)didReceiveMemoryWarning;
    

    callback and set the references to nil there. Not sure if this is the best way of dealing with the situation, but it works.

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

Sidebar

Related Questions

I have two UITableView, each one has a different delegate in the same UIViewController.
I have two UITableview's and if i select a one row in each table,
I have an uitabbarcontroller which contains a couple uiViewControllers. When i show one of
I have a ViewBased App. I added a UITableView on one of the UIViewControllers.
I have a UITabBarController which has on one of its tabs, a UINavigationController. The
I have this code in my table view controller (and delegate): - (void)tableView:(UITableView *)tableView
I have a main UIViewcontroller (vcMain) with two UIViewControllers subclassed from the main one.
In my Xcode 4.2 storyboard, i have 2 UIViewControllers , This one time and
I have a multi view application with individual UIViewControllers and xibs. I have one
I have one UIViewController (DownloadManager) which downloads a webpage with UIWebView and display the

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.