PDA

View Full Version : order in arrangedObjects




MrFusion
Oct 30, 2009, 08:51 AM
Hi

Does anyone know if the order is guaranteed when fetching objects from an NSArrayController with arrangedObjects? Assuming that I do not provide filters or sortdescriptors.
I have to fetch objects from core data. Calculate stuff and return the data to the objects in the exact same order as I originally fetched the objects.

Or do I have to override this method to ensure the same order?

- (NSArray *)arrangeObjects:(NSArray *)objects


I would say yes, of course. Both from the name of the method and my experience with NSTableviews binded to arrangedObjects.
But the documentation does not state it explicitly and I have to be 100% sure.



HiRez
Oct 30, 2009, 01:46 PM
No, the order is not guaranteed at all, even between fetches on an unmodified array. You will need to provide sort descriptors (or set the default ones in IB), or as you say provide your own custom filtering by overriding arrangeObjects:

MrFusion
Oct 30, 2009, 03:12 PM
No, the order is not guaranteed at all, even between fetches on an unmodified array. You will need to provide sort descriptors (or set the default ones in IB), or as you say provide your own custom filtering by overriding arrangeObjects:

Ok.
Thanks for the reply.