Skip navigation.
 
mlRe: How to disconnect bound views temporarily
FROM : Andy Mroczkowski
DATE : Sun Jun 15 17:26:35 2008

Hi Markus,

I'm guessing that your NSArrayController is in the nib itself.  One 
thing you could do is instantiate it programmatically and set it as an 
ivar of some other controller class in the nib (lets call it 
MyWindowController).  Then bind the views to the 
MyWindowController.arrayController.arrangedObjects (or whatever the 
applicable keypath is).

When your view is hidden, you can set 
MyWindowContoller.arrayController to nil and it *should* just work. 
We've used this same pattern in our code, but we're only using the 
arrangeObjects and selectedObjects keypaths of NSArrayController.

Also, I haven't played with NSCollectionView, but it seems odd that it 
has problems if the data changes when its not visible.  It sounds like 
a bug to me...

- Andy



On Jun 15, 2008, at 3:39 AM, Markus Spoettl wrote:

> Hi List,
>
>  I have a document window that can show the same data in more than 
> one way, very much like Finder, one view mode is an outline, the 
> other is a collection. Both are bound to the same data, so they 
> reflect changes automatically.
>
> I was wondering if there is some way to tell a controller class 
> (like NSArrayController) to temporarily disconnect the bound view 
> from the data (other than removing the binding itself). It seems 
> that the views are updating the data even if they are not visible, 
> consuming memory and processor time. Moreover, NSCollectionView does 
> seem to have problems when it's not visible and the data changes (I 
> get debug log entries about assertion failures in NSView lockFocus).
>
> Thanks
> Markus
> --
> __________________________________________
> Markus Spoettl
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/andy.<email_removed>
>
> This email sent to andy.<email_removed>

Related mailsAuthorDate
mlHow to disconnect bound views temporarily Markus Spoettl Jun 15, 09:39
mlRe: How to disconnect bound views temporarily Andy Mroczkowski Jun 15, 17:26
mlRe: How to disconnect bound views temporarily Markus Spoettl Jun 17, 09:11