Got it, it all works (I think :).

The only thing that made me scratch my head was how to empty the whole
array.  Right now I am using this, but any suggestions or improvements
are welcome:

NSRange range = NSMakeRange(0, [self countOfMyObjects]);
NSIndexSet *indexes = [NSIndexSet indexSetWithIndexesInRange: range];

[self removeMyObjectsAtIndexes: indexes];


- (void) removeMyObjectsAtIndexes: (NSIndexSet *)indexes
{
    [self.myArray removeObjectsAtIndexes: indexes];
}



Thanks,

- Koen.




On Mon, Apr 30, 2012 at 12:40 PM, Quincey Morris
<[email protected]> wrote:
> On Apr 30, 2012, at 09:27 , Koen van der Drift wrote:
>
> I am using an NSMutableArray to store the myObjects, the table
> displays several properties of each object in seperate columns.  So
> the order in which the objects are stored in the array is not
> critical, they will be ordered once displayed in the table and the
> user can select which column to use for ordering. Therefore I don't
> think I need to use the 'indexed mutable accessors', but the 'mutable
> unordered accessors' as discussed in the same link from mmalc.   Am I
> correct here?
>
>
> No, you have to use the indexed accessors, because the NSArrayController
> that mediates between your data model and your UI (NSTableView) expects the
> property to be indexed -- i.e. to behave like an array -- even though the
> contents get re-sorted before display.
>
> [Confusingly, this is only true when you're using an array controller in
> "Class" (normal) mode. When you're using an array controller in "Entity"
> (Core Data) mode, it expects the property to be unordered, since that how
> Core Data to-many properties are modeled. Of course, in this case, you're
> not implementing the accessors yourself.]

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to