On 1/24/13 5:48 PM, "Quincey Morris" <quinceymor...@rivergatesoftware.com> wrote:
>On Jan 24, 2013, at 17:37 , Graham Cox <graham....@bigpond.com> 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 (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com