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

The Archive Base Latest Questions

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

UITableView allows you to batch editing operations using beginUpdates and endUpdates . My question

  • 0

UITableView allows you to batch editing operations using beginUpdates and endUpdates.

My question is: do I need to know whether it does deletions or insertions first? Or can I refer to everything by the index path prior to beginUpdates and it’ll magically work?

Suppose I have a table:

A (currently index path 0,0)
B (0,1)
C (0,2)
D (0,3)
E (0,4)
F (0,5)

I want to turn it into:

A (0,0)
C (0,1)
D (0,2)
H (0,3)
E (0,4)
F (0,5)

Thus, I’ve deleted B (which was at 0,1) and inserted H (which was inserted after D — at 0,4 before the deletions, or 0,3 after).

So, between my begin/end updates calls, which of these will work?

  1. deleteRowsAtIndexPaths: 0,1, followed by insertRowsAtIndexPaths:
    0,4
  2. deleteRowsAtIndexPaths: 0,1, followed by
    insertRowsAtIndexPaths: 0,3
  3. insertRowsAtIndexPaths: 0,4, followed by deleteRowsAtIndexPaths: 0,1
  4. insertRowsAtIndexPaths: 0,3, followed by deleteRowsAtIndexPaths: 0,1
  • 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:27:49+00:00Added an answer on May 24, 2026 at 6:27 am

    The relevant Apple documentation for this is under Ordering of Operations and Index Paths.

    Deletion and reloading operations within an animation block specify which rows and sections in the original table should be removed or reloaded; insertions specify which rows and sections should be added to the resulting table. The index paths used to identify sections and rows follow this model.

    So the table view will first perform any delete or update operations, whose index paths refer to index paths in the original table contents. Then insertions are performed, and those index paths refer to index paths after deletions have occured.

    So in theory your number ‘2’ option should be the one you want.

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

Sidebar

Related Questions

I have a button (a UINavigationBarItem) used for editing my UITableView, which only allows
I'm using a UITableView to show some data from an array. This array can
I'm using a UITableView to layout content 'pages'. I'm using the headers of the
I am using the code below to put together my UITableView. The Cell height
I'm using a UITableView to allow selection of one (of many) items. Similar to
I have a custom UITableView that allows the user to select multiple images. The
I have a NSFetchedResultsController which displays data in a UITableView. I'm using the boiler
I have a UITableView put in edited mode. self.tableView.editing = YES; In this table
The standard Grouped UITableView style allows UITableViewCell s to be drawn with rounded corners
I am using a UITableView and the cells I am using in this view

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.