How can I make deleteRowsAtIndexPaths: work with GenericTableViewController?

前端 未结 1 1526
孤城傲影
孤城傲影 2020-12-05 00:49

I\'m using Matt Gallagher\'s GenericTableViewController idea for controlling my UITableViews. My datasource is a NSFetchedResultsController

相关标签:
1条回答
  • 2020-12-05 01:36

    Well, bah. I just found this answer, which is not the same, but got me headed in the right direction. I'll leave this here for anyone in the future having similar troubles.

    The key is to wrap the deleteRowsAtIndexPaths with begin and end tags, and force the model to update within the same block, resulting in:

    [tableView beginUpdates];
    [self constructTableGroups];
    [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]
            withRowAnimation:UITableViewRowAnimationFade];
    [tableView endUpdates];
    

    This caused the issue to go away, and the animations to work just perfectly.

    0 讨论(0)
提交回复
热议问题