Handle row deletion in UITableViewController

Posted by Kamchatka on Stack Overflow See other posts from Stack Overflow or by Kamchatka
Published on 2010-05-06T14:58:39Z Indexed on 2010/05/06 15:18 UTC
Read the original article Hit count: 316

Hello,

I hava a UINavigationController. The first level is a UITableViewController, the second level just shows details on one of the items of the table view.

In this detail view, I can delete the item. It deletes the underlying managed object.

When I pop back to the view, I have a crash. I understand why, it's because I didn't update the cached array that contains the data.

I looked at several tutorials and I don't exactly understand how am I supposed to handle deletion. Maybe I don't understand exactly where I should fetch the objects in the model. Should I do a query for every cellForRowAtIndexPath and take the item in the result at position indexPath.row? It doesn't look efficient. Should I check for changes somewhere and recache the whole query in an array. I would think CoreData would provide something more natural but I couldn't find it so far.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about core-data

Related posts about iphone