I have found many core data with nsfetchedresultscontroller tutorials, but none of them are easy to follow and most of them dont do what i want. All i want is a table view that adds/ and delets cells. I already have this working perfect! I just want to save the state of the table view when the app is left! Please some one point me in the right direction of a good tutorial!! Thanks everyone!
I have found many core data with nsfetchedresultscontroller tutorials, but none of them are
Share
You are looking at the wrong place check in the UITableView class reference this method:
Or Better :
And Finally
If I’ve understand correctly your question
those are the information you need to look at, the rest should be implementation detail.
It’s not one or the other.
You need to understand this, The only purpose of the NSFetchedResultsController is to maintain a collection of data.
From time to time the
UITableViewControllercall theNSFetchedResultsControllerand ask it, what are the information I need to display at this position.And on some other time the
UITableViewControllercall theNSFetchedResultsControllerand tell it, hey… I’ve got that thing that someone told me to delete… well I don’t know what to do with that, could you take care of it (you have to implement so method for that).But in no condition the
NSFetchedResultsControlleris aware of the position of theUITableViewand it’s never tell it to go any where. It’s always the other way around.So yes you should continue learning Core Data it’s a very useful tool.
As of your question, when your application is about to go to the background you have the time to look where your what are the visibleRows and save that information somewhere, like in the NSUserDefault. When you get back you read that data back and you tell the table view to go there, not animated.