Re: View Based TableView - how to use bindings?
Re: View Based TableView - how to use bindings?
- Subject: Re: View Based TableView - how to use bindings?
- From: Quincey Morris <email@hidden>
- Date: Wed, 01 May 2013 13:16:32 -0700
On May 1, 2013, at 12:52 , "Gerriet M. Denkmann" <email@hidden> wrote:
> Can't find the method: 'tableView:viewWithIdentifier…'. But makeViewWithIdentifier:... is never called. It was used in ...viewForTableColumn:... which was never called and has just been removed.
> I guess this is the root of the problem: I do not know where to call makeViewWithIdentifier.
> But do I need to? both things in the NSTableCellView have bindings already.
The header comments for 'tableView:viewForTableColumn:' say:
> Bindings: This method is optional if at least one identifier has been associated with the TableView at design time. If this method is not implemented, the table will automatically call -[self makeViewWithIdentifier:[tableColumn identifier] owner:[tableView delegate]] to attempt to reuse a previous view, or automatically unarchive an associated prototype view.
So you don't need the method (because you have bindings), but you need to make sure that the table column identifier matches the interface identifier of the "prototype" view.
> id g = [ self.arrayController arrangedObjects ]; // _NSControllerArrayProxy
> NSLog(@"%s arrangedObjects %ld ",__FUNCTION__, [g count]);
> prints 39 as expected. So the array controller is not empty. It also contains correct objects.
>
> Just bound the image to "objectValue.AbsoluteNonsense" and did not get any error messages. Is this normal?
If it's not creating any cell views, there won't be any errors.
I think you still need to find out whether it's the table view binding or the cell view binding that's failing. You could insert a line of code, after the table view is supposedly initialized, to query the number of rows and see if it's 39.
Note that the fact that the array controller contains the right objects doesn't necessarily mean anything, if KVO compliance is messed up. It's a matter of timing, in that case, as to what results you get. You could try throwing in a 'reloadData' for the table, once you're sure the array controller has the right content, and see if that changes things. If so, you have a KVO compliance problem earlier in the initialization.
_______________________________________________
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