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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:12:09+00:00 2026-06-01T09:12:09+00:00

I have a rather complex data source for my UITableView. I am very carefully

  • 0

I have a rather complex data source for my UITableView. I am very carefully keeping it in sync with the tableview itself, inserting and removing rows/sections manually (with animation) whenever some data changes, and vice versa.

It is hard to be 100% confident in my ability to keep these matched up. The effects of a mis-match between the view and the data can be severe – for example, selecting a row and trying to do something to the associated object, when that object does not exist, will cause a crash. Many other bugs would lead to less obvious errors (operating on the wrong object, for example).

I was thinking about how all of this goes away if I call reloadData after each data change instead of manually modifying the view. But then I would lose the animation.

So perhaps I could somehow call reloadData after my animations have ended, as a safety measure.

  • Does this sound like a good idea? Any alternatives?
  • Where would I place this call so that the reload only occurs after animation (and would thus be invisible to the user if all is well)?
  • Is there anything I could do to compare the view before and after reloadData, to identify if anything changed on the screen and throw a warning, for debugging purposes? I expect this would only work on rows that are in view, since offscreen content is dequeued only when required.

Interested in your thoughts!

  • 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-01T09:12:10+00:00Added an answer on June 1, 2026 at 9:12 am

    I feel your pain. Unfortunately, I don’t think that the reload idea helps much. If there’s a discrepancy between the model and the table view, in my experience the problem manifests as an exception before or during the update animations. If there’s a problem, I’ve found that you don’t make it to the reload, and I don’t think you want to.

    These are some risk factors that, in my experience, lead to models prone to get out of synch with a table view:

    • model count and model items that come from more complex calculations
      than simple array counts and array itemAtIndex:
    • filters, like tabs that show a different aspect of the model in the same table based on which tab is selected
    • search results controller and it’s tableView
    • updates based on events that are triggered asynchronously
    • heterogenous types in the model, with different cell types and sizes
    • one clumsy word: FetchedResultsController
    • and especially combinations of the above

    This goes a little beyond table views, and, I don’t claim to be a perfect practitioner of all the preaching here, but I think the way to get confidence in your app includes the following:

    1. Build the UI with no art and as little app logic as possible; just a
      mock version of the model – to the extent possible – equal in
      complexity but not in volume, to the real thing.

    2. Build the model and app logic, along with tests that – to the extent
      possible – exercise it independently of the UI.

    3. While you’re testing, embrace exceptions as your friend, telling you that you need a fix. Insert as little defensive code as you can for as long as possible.

    My $0.02. Best of luck.

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

Sidebar

Related Questions

I have this rather complex query that grabs data from three tables, and now
I have a rather complex data structure I've implemented in Perl. This has been
We have a rather large and complex application written in Java which is running
I have a rather large and complex game in C#, and in it are
I have a window that contains several rather complex views. Right now, I'm using
I have a hash table where the keys are rather complex lists, with sublists
I have a number rather large, complex xml documents that I need to loop
I have a PHP class that stores a complex multidimensional array, and rather than
I have a rather enormous project in which I'm trying to retrofit in-memory data.
I have a rather complex database-query which gives me 30 million records - roughly

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.