-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App is crashing when dragging custom cell to a new section #45
Comments
To fix this call reorderRowAt delegate after deleting the row tableView.beginUpdates()
|
Are you updating your data model in |
Yes I was updating data model in tableView(_:UITableView, reorderRowAt:IndexPath, to:IndexPath) |
I had a similar issue because somewhere in my code I was calling tableView.endUpdates() to fix a bug with TBEmptyDataSet, and had never called tableView.beginUpdates() - you might check that you have matching beginUpdates and endUpdates calls for any updates you have. |
I'm getting this same crash. I tried the suggestion of adding the The issue seems to center around the fact that before you can let go of the row, it has been moved to the new section, saved, and is now attempting to move back to another section next to it in a split second. It's very strange. I've always wondered why this library saves every time the user drags and doesn't save once when you let go of the row (where it can check the drop destination and then save it). Maybe that's how the original UIKit delegate method works. Anyone else running into this? Any other ideas for a solution? |
@cliftonlabrum perhaps try installing w/ cocoapods and debugging. I also had a lot of issues with new iOS 13 features with this lib and ended up going over to Apple's Drag/Drop delegates - works great. Had an example project to work with - was pretty convoluted for me to attempt at first without the example. Good luck. |
@thejeff77 Thanks. Are you referring to something other than just the built-in UIKit way of reordering Do you have a link to that sample project you are referring to? |
@cliftonlabrum no I am referring to UIKit drag and drop delegates, although there are ways to customize the drag placeholder view. I'm not sure what you mean by the icons/lines but I know of some ways to remove the 1px separators from the cells. I received the example project from apple code support, so I won't post it but I'll try to get around to emailing it to you. The example doesn't have multiple sections tho. |
I found a super helpful Stack Overflow post that shows how easy it is to enable drag and drop for a Just add the drag delegates to your table:
...and one delegate method:
Then use the usual |
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'attempt to delete row 2 from section 0 which only contains 2 rows before the update'
Getting this error while dragging 3rd row from 0th section to 1st row of 1st section
The text was updated successfully, but these errors were encountered: