Insert cells at the top of a table using NSFetchedResultsController

My application uses basic data, and I use NSFetchedResultsController to populate my table. however, when I insert a new cell, it is inserted into the table in alphabetical order (either ascending or descending according to sortDescriptor). I want it to be inserted only at the top. I tried to comment on sortDescriptor, but the application will work as NSFetchedResultsController requires it. any idea how i can fix this? and I got the question, probably not so. now my application has basic data, and later I want to add icloud support. so should i follow the NSFetchedResultsController approach in my code so that my application is ready later? or can i follow any approach? I tried other approaches, and the main problem I posted was fixed as it was more flexible.

+4
source share
1 answer

Add the createdDate attribute or something similar to your model (if you don't already have one). After that, you can use this attribute in sortDescriptor to order NSFetchedResultsController

+2
source

All Articles