Why is fetchedResultsController set to nil?
Why is this in the FetchedResultsController code开发者_JAVA技巧 that Apple gives us?
if (fetchedResultsController != nil) {
return fetchedResultsController;
}
This is because they only need to set up the fetchedResultsController
once.
Below that statement there is a load of set up to initialise
fetchedResultsController
.
So the first time you hit the method by calling fetchedResultsController
the ivar is set up then any subsequent calls to fetchedResultsController
simply return the already set up ivar.
精彩评论