order in arrangedObjects

Discussion in 'Mac Programming' started by MrFusion, Oct 30, 2009.

  1. macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #1
    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?
    Code:
    - (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.
     
  2. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #2
    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:
     
  3. thread starter macrumors 6502a

    Joined:
    Jun 8, 2005
    Location:
    West-Europe
    #3
    Ok.
    Thanks for the reply.
     

Share This Page