Version 6 - Chapter 5. Reordering Rows

Hi everyone. (Beginners question!) I’d like to enable reordering of rows in the table view. Chapter 5 mentions case.move, but there is no example of how you would setup the code in the view controller (e.g., fromIndexPath…toIndexPath).

I can’t find any examples in the book that illustrate reordering rows (when used with fetched results controller delegate). Is someone able to provide an example? Any help would be greatly appreciated! :sweat_smile:

1 Like

@and1 Thanks very much for your question!

I am a bit confused here with what you mean by “reordering”. You have also highlighted the section of the NSFetchedControllerDelegate method, “didChange” for moving a row from one place to another. Moving a row is exactly that: changing the position of a row inside a UITableView, and placing it in another location. Thus, a move is really the deletion of that row from it’s original position, and inserting it at a new position.

By reordering, are you referring to changing the criteria by which the data is listed in the UITableView, or simply reloading the contents of the UITableView after an insert, delete, update, or move function has taken place?

Let us know what you mean by “reordering” exactly, and hopefully we’ll have an answer for you. :slight_smile:

I hope this helps!

All the best.

Hi syedfa, thanks for the clarification! :smile:

I’d like to be able to manually move a row from one place to another - change the position of a row inside a UITableView, and place it in another location. I’m modifying the World Cup app to hopefully be able to drag & drop to move the rows within any given section. But, I just can’t seem to work out what I need to add to the move method, & perhaps elsewhere, to make this work! :sweat_smile:

Move Row

This topic was automatically closed after 166 days. New replies are no longer allowed.