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

  • Home
  • SEARCH
  • 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 3595940
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:55:07+00:00 2026-05-18T19:55:07+00:00

I have a table view with more than 1000 cells (I display about 10

  • 0

I have a table view with more than 1000 cells (I display about 10 on the screen). Following a “filter” action by the user I want to remove about 80% of them, then after a second filter another 80%. When working with 100 cells it’s roughly instantaneous but with a 1000 it takes 0.5 seconds to finish the method [tableView endUpdates] and this totally destroys the user experience.

I create the array of Index Paths like this:

for (int i=1; i<[appDelegate.myArray count]; i++) {   //more than 1000 objects in myArray
    if (![[appDelegate.myArray objectAtIndex:i] myTest]) {  //myTest returns a BOOL 
        [appDelegate.rowsToDelete addObject:[NSIndexPath xxxxx]]; //the index path of the object that just failed the test and must be removed];
 }
}
[self.myTableViewController.tableView deleteRowsAtIndexPaths:appDelegate.rowsToDelete withRowAnimation:UITableViewRowAnimationRight];

I have tried 2 solutions, one is threading so that my user can see other parts of the UI moving whist the tableView is updating. But if he launches another level of filtering this often results in the long wait if not a crash.

I have also tried to remove the first few cells (those on the screen) and then just remove the other objects that have failed the test from the datasource without removing their corresponding cells from the tableView as they are out of sight. This gives the good, rapid result, but I then get problems with the number of rows such as:

‘Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (94) must be equal to the number of rows contained in that section before the update (927), plus or minus the number of rows inserted or deleted from that section (0 inserted, 215 deleted).’

Has anybody had such a performance issue? ways to solve it?
Cheers,
CD

  • 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-18T19:55:08+00:00Added an answer on May 18, 2026 at 7:55 pm

    Try caching properties and using fast enumeration for your loop:

    //int i = 0;
    NSMutableArray *rowsToDelete = appDelegate.rowsToDelete;
    for(id current in appDelegate.myArray) {
        if([current myTest]) [rowsToDelete addObject:[NSIndexPath ...]];
        //++i;
    }
    [self.myTableViewController.tableView deleteRowsAtIndexPaths:rowsToDelete withRowAnimation:UITableViewRowAnimationRight];
    

    If you use the index of the item to create the NSIndexPath, uncomment the first and fifth lines. Also, i noticed that in your code you start at i=1. Since NSArrays start at 0, this would never delete the first cell. If you actually want this, change i = 0 to i = 1.

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

Sidebar

Related Questions

In my iPhone application I have a table view. When user taps any row,
I have more than 3 views and also one window view ( pdfReader.xib nib
Here's my case: I have a table view showing contacts. Add button in the
I have a grouped table view with textfields in the tableview. For the keyboard
I have a name of table or view in PostgreSQL database and need to
I have a situation where I build a view with a table and another
I have the following situation: 1) 1 X PhotoTableViewController to display a list of
I have a view that is joining two tables and ordering by the first
I have table inside a div tab. The table has 40 rows in it
I have table with 50 entries (users with such details like Name Surname Location

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.