Re: How to: NSTableView redisplay
Re: How to: NSTableView redisplay
- Subject: Re: How to: NSTableView redisplay
- From: Graham Cox <email@hidden>
- Date: Wed, 29 Feb 2012 17:02:59 +1100
On 29/02/2012, at 3:39 PM, Erik Stainsby wrote:
> Learning a new language makes me humble.
>
> NSTableView - I have an NSTableViewDataSource with an array holding the objects to be represented in the table.
> I add a new object to the array, I call [table reloadData]; and I follow that with [table setNeedsDisplay:YES];
> Bupkiss. Nada. However, when I tap a column header to resort the view, presto. Content.
>
> What am I missing ?
>
> - (void) appendRule:(NSNotification *) note {
> RSTrixieRule * rule = [note object];
> [_rules addObject: rule];
> [table reloadData];
> [table setNeedsDisplay:YES];
> }
You don't need to call -setNeedsDisplay: on the table, -reloadData: does that for you. So it should work. Is <table> definitely correct? How does your data source object obtain that? A common way is to have an IBOutlet and just hook it up in the nib. But check that it's not nil, which would indicate that you didn't hook it up. Another common error is to define the datasource in the nib but then instantiate another copy of it in code, so check that as well.
And just for completeness, you have implemented -numberOfRowsInTableView: and -tableView:objectValueForTableColumn:row: ???
--Graham
_______________________________________________
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