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

The Archive Base Latest Questions

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

I’ve enabled editing mode and moving cells around to allow users to position table

  • 0

I’ve enabled editing mode and moving cells around to allow users to position table view content in the order they please. I’m using Core Data as the data source, which sorts the content by the attribute “userOrder”. When content is first inserted, userOrder is set to a random value. The idea is that when the user moves a cell around, the userOrder of that cell changes to accomodate its new position. The following are problems I am running into while trying to accomplish this:

  1. Successfully saving the the new location of the cell and adjusting all changed locations of influenced cells.

  2. Getting the data to be consistent. For example, the TableView handles the movement fine, but when i click on the new location of the cell, it displays data for the old cell that used to be that location. Data of all influenced cells gets messed up as well.

I know I have to implement this in:

- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath {}

I just don’t know how. The apple docs are not particularly helpful if you are using Core Data, as in my situation.

Any guidance greatly appreciated!

  • 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-14T19:35:56+00:00Added an answer on May 14, 2026 at 7:35 pm

    Problem 1 is pretty much independent of using CoreData, just think of a simple array:

     {0 1 2 3 4 A}. 
    

    Now the user moves some freshly appended element A within the Array:

     {0 1 A 2 3 4}
    

    So starting with the inserted element A, which receives the index 2, all elements need to have their index (which is userOrder in your case) incremented by one.
    So you map 0->0, 1->1, A->2, 2->3, 3->4 and so on.

    Problem 2 may have two or three sources:

    1. Either your CoreData values are not synced so the database is not in sync with what you see.
    2. [table reloadData] was not called
    3. Your move-Algorithm is wrong

    So perhaps you can check the thee points above and if none applies you could consider posting your move-algorithm for closer examination.

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

Sidebar

Ask A Question

Stats

  • Questions 418k
  • Answers 418k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Two options: Replace the core plugin's folder in _source/plugins. Name… May 15, 2026 at 9:54 am
  • Editorial Team
    Editorial Team added an answer It is possible to use GROUP BY on a column… May 15, 2026 at 9:54 am
  • Editorial Team
    Editorial Team added an answer I would recommend the MySQL Python Connector, a MySQL DB-API… May 15, 2026 at 9:54 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.