I have a bunch of files in various sizes (>100) stored in iCloud. I have a NSMetadataQuery
that returns these files. They are reported to my app from the NSMetadataQuery
object in random order.
I open them and extract a couple of strings which then get sorted and displayed in a UITableView
.
I have tried two approaches:
A) loading each file, sorting the array of files informations, and calling reloadData
on the UITableView
each time.
and B) waiting for all the files to have loaded and then sort the "full" array and then call reloadData
once.
Option B is obviously better but basically takes just as long for the user to see results. How does one do this best?
Do I need to extract the data I display in the UITableView
into a different file (i.e. PLIST), so that I can load that quicker and display it while the actual data is being loaded in the background?
Or do I need to basically extend implementation A by keeping track of the Array and then calling reloadRowsAtIndexPaths:
for each row that subsequently gets changed due to the sort?
What is the best practice for this scenario?
Thanks
From a user point of view, faster is better, and seeing something, even incomplete, is better than seeing nothing. So:
Changing from reloadData
to reloadRowsAtIndexPaths:
makes for better animations, so is nice to have but not required and doesn't make things faster.