开发者

How do I prevent cellForRowAtIndexPath being called for offscreen cells inserted by NSFetchedResultsChangeInsert & insertRowsAtIndexPaths

I am processing an XML and creating managedObjects asynchronously. I have a tableview which reacts to that by inserting cells with NSFetchedResultsChangeInsert.

But all the cells that are inserted in the table by NSFetchedResultsChangeInsert & insertRowsAtIndexPaths are triggering cellForRowAtIndexPath and willDisplayCell. Even when they are not on screen. This results in unneeded cell processing which should only be done when the cell is actually visible.

How do I dynamically insert objects in the table via 开发者_JAVA技巧NSFetchedResultsChangeInsert while not triggering rendering stuff when they are not on screen?


Problem found. I think that all the CoreData objects were triggering the NSFetchedResultsControllerDelegate methods because I saved the context with all the objects in the end. If I save the context after each object I create, I only see cell updates for those cells that are visible.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜