Re: NSTableView: bindings with drag and drop
Re: NSTableView: bindings with drag and drop
- Subject: Re: NSTableView: bindings with drag and drop
- From: Chuck Soper <email@hidden>
- Date: Thu, 24 Jan 2013 18:11:55 -0800
- Thread-topic: NSTableView: bindings with drag and drop
On 1/24/13 5:48 PM, "Quincey Morris" <email@hidden>
wrote:
>On Jan 24, 2013, at 17:37 , Graham Cox <email@hidden> wrote:
>
>> 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.
>
>This is sensible, well-reasonable, believable and not true. :)
>
>This is from the table view programming guide:
>
>> "While the NSTableViewDelegate Protocol protocol declares the data
>>providing methods as @optional, all datasources that programmatically
>>populate cell-based table views must implement those methods. The
>>methods that that provide the number of rows and the content for each
>>item within the table are marked as @optional because they are optional
>>when using Cocoa bindings."
>
>and the NSTableViewDelegate protocol reference says essentially the same
>thing.
>
>My guess is that Chuck didn't declare his data source class as conforming
>to NSTableViewDelegate, and that in that case the table view
>implementation falls back to looking for informal conformance.
Here's my declaration. The table view is an ivar.
@interface MyCustomView : NSView <NSTableViewDelegate,
NSTableViewDataSource>
If I do not implement numberOfRowsInTableView: and
tableView:objectValueForTableColumn:row: then this error is written to the
console:
*** Illegal NSTableView data source (< MyCustomView: 0x1019ab7b0>). Must
implement numberOfRowsInTableView: and
tableView:objectValueForTableColumn:row:
If I change my declaration to this: @interface MyCustomView : NSView
<NSTableViewDelegate>
then I get this build warning:
Sending 'VTRColumnView *__strong' to parameter of incompatible type
'id<NSTableViewDataSource>'
This isn't a critical issue, I was just wondering if someone had
encountered the same situation.
Chuck
_______________________________________________
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