Table view rows cannot be moved to newly inserted sections

Originator:alek.astrom
Number:rdar://17684030 Date Originated:2014-07-15
Status:Open Resolved:
Product:iOS SDK Product Version:7.1.2
Classification:Enhancement Reproducible:N/A
 
Summary:
When inserting a new section and moving a row into that section in the same begin/end updates block for a UITableView, an NSInternalInconsistencyException is fired with the reason "cannot move a row into a newly inserted section". The equivalent happens when trying to move a row from a section which gets deleted in the same updates block.

The workaround for this is deleting the moving row from its old section and re-inserting it into the new section. This produces an undesirable animation which breaks the user's mental model of an object (represented by the cell) moving and instead looks like an entirely new object is created to be inserted into the new section.

Attached is a demo iOS project containing a UITableView and two buttons that trigger the bug or display the workaround.

Steps to Reproduce:
1. Create a UITableView with one section containing two rows
2. In a single begin/end updates block, insert a new section and move one of the rows from section 0 to section 1 using the moveRowAtIndexPath:toIndexPath: method.

Expected Results:
The row displays a move animation to move from section 0 to the newly inserted section 1.

Actual Results:
An NSInternalInconsistencyException is fired, with the reason "cannot move a row into a newly inserted section (1)"

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!