On 7 Apr 2009, at 9:13 PM, Maxwell, Adam R wrote:

>
>
>
> On 04/07/09 09:25, "Christiaan Hofman" <[email protected]> wrote:
>
>>
>> On 7 Apr 2009, at 4:41 PM, Adam R. Maxwell wrote:
>>
>>>
>>> On Apr 7, 2009, at 2:59 AM, Christiaan Hofman wrote:
>>>
>>>> Also you should not need to implement KVC accessors for
>>>> content.
>>>
>>> I don't think so either, but IB seems to call it (even if not
>>> calling super for the content binding).
>>
>> Are you really sure it's not a side effect of some other thing? If
>> this is true it's a bug, binding names are not required to be KVC
>> compatible.
>
> It may be specific to a certain IB version.  I'll check on that and  
> file a
> bug if needed...
>
>>> To what are you referring as a hack?  Unbinding in
>>> viewWillMoveToSuperview?  How are bindings unbound otherwise?  In
>>> that case I think I was mainly following mmalc's example code.
>>
>> Bindings should always be removed manually or using the nib (which
>> uses some special proxy to manage bindings).
>
> In the IB plugin test, unbind: isn't called unless it's done  
> manually in
> viewWillMoveToSuperview:; I don't see any magic happening from the  
> xib.  The
> official recommendation is to unbind in viewWillMoveToSuperview:  
> unless the
> view will become full-screen [1].
>

In this case that's because the NIB is the main nib, which is never  
cleaned up. The magic happens only when the controller is cleaned up  
and when it's a standard nib controller (NSWindowController,  
NSViewController, NSDocument). It binds through a proxy aptly named  
NSAutoUnbinder (IIRC).

>>> I've thought about something similar to what you suggest with
>>> respect to selection indexes, but never got around to it (I mainly
>>> didn't feel like debugging it).
>>
>> I've got it implemented in the main bibdesk tree. It doesn't have the
>> IB plugin though, so I haven't tested that aspect. It even supports
>> value transformer options.
>
> I actually use the IB plugin, so I have to include that in testing.  I
> loathe value transformers, so intentionally avoided that particular  
> problem
> :).  Might actually be useful for BibDesk, though.

I thought you didn't like bindings in BibDesk ;-)

> [1] http://homepage.mac.com/mmalc/CocoaExamples/controllers.html#unbinding


The workaround mmalc uses is not always usable. He mentions fulscreen  
windows as an example, but also swapping in views would have the same  
problem. I wonder how it works with NSTabView. Though it might not  
always be relevant, because it's probably not removed from the  
superview.

Moreover, I think this approach may mess up proper balancing of bind  
and unbind. Remember that often if that's not taken care of this may  
lead to exceptions.

Christiaan


------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Bibdesk-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-develop

Reply via email to