Re: NSTableView doesn't show data until I click on a header
Re: NSTableView doesn't show data until I click on a header
- Subject: Re: NSTableView doesn't show data until I click on a header
- From: Koen van der Drift <email@hidden>
- Date: Wed, 02 May 2012 22:15:00 -0400
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@hidden> 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@hidden)
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:
This email sent to email@hidden