Re: NSTableView: bindings with drag and drop
Re: NSTableView: bindings with drag and drop
- Subject: Re: NSTableView: bindings with drag and drop
- From: Graham Cox <email@hidden>
- Date: Fri, 25 Jan 2013 12:37:44 +1100
On 25/01/2013, at 12:31 PM, Chuck Soper <email@hidden> wrote:
> When I use bindings for NSTableView and implement drag and drop, an
> "Illegal NSTableView data source" error is written to the console. This is
> because I use NSTableViewDataSource methods to implement drag and drop.
>
> I'm able to prevent the error message if I declare these bogus
> NSTableViewDataSource protocol methods:
> - (NSInteger)numberOfRowsInTableView:(NSTableView *)aTableView
> { return 0; }
> - (id)tableView:(NSTableView *)aTableView
> objectValueForTableColumn:(NSTableColumn *)aTableColumn
> row:(NSInteger)rowIndex
> { return nil; }
>
> Everything seems to work fine. Has anyone else encountered this issue?
> Is there a better way to avoid this error message? Or, is this considered
> a bug?
If the table view has a dataSource assigned, it has to be "legal", which means it must implement those two methods. The fact that, with bindings, they may not ever be called is irrelevant. The dataSource must conform to the compulsory protocol. I wouldn't call it a bug, just a very strict interpretation of the docs.
--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