Re: Another bindings question
Re: Another bindings question
- Subject: Re: Another bindings question
- From: Quincey Morris <email@hidden>
- Date: Wed, 03 Jun 2015 00:38:05 +0000
On Jun 2, 2015, at 17:18 , John Brownie <email@hidden> wrote:
>
> What I have is an NSTableView (still cell-based, moving to view-based is further down the track), and then a bunch of buttons that need to be enabled only when there is a selection in the table. Binding to the selection property of the array controller with NSNotNil doesn't work. Binding to selectionIndexes.count (which works as 0 or 1) does work, but this is the binding where I get the exception. Finding that binding was trial and error, as I haven't really found a good guide to this whole area, so I would be happy to have a better solution.
The most straightforward property to bind the button enabled state to is “canRemove”. (It just means something is selected.) It’s easy to miss because it’s actually defined in the parent class (NSObjectController), *and* it’s apparently missing from the class documentation. However, it’s still documented in NSObjectController.h, so it’s really available.
This probably won’t solve your problem. More likely you’ve a place where a non-owning reference (weak or unretained, such as for a delegate) is still pointing to an invalid object. In some cases, you need to nil out delegate references when tearing down your object graph.
_______________________________________________
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