On Jul 18, 2012, at 23:22 , Markus Spoettl wrote:

> That doesn't sound right. The array controller is used by views directly, 
> they bind to arrangedObjects (like in the example). Since when is it 
> recommended to insert an intermediate object between table view and 
> NSArrayController? Makes the whole binding idea rather useless, or am I 
> missing something?

I wasn't thinking about inserting an intermediate object there. Rather, I was 
thinking of two techniques (and I am sure there are plenty of others) for 
preventing KVO operations from triggering unwanted expensive updates:

1. Use the cancelPerform/performSelector…afterDelay:0 pattern to defer the 
expensive operation until the next run loop iteration AND prevent it from being 
queued more than once.

2. Use a brute force flag when setting the predicate, something like this:

        dontStartExpensiveUpdate = YES;
        [_arrayController setPredicate: …];
        [_arrayController rearrangeObjects];
        // at this point, the KVO notification has been sent up to twice, but 
ignored each time
        dontStartExpensiveUpdate = NO;
        … do the expensive update now …

Suggestion #1 would coalesce all rearrangements during a single run loop 
iteration (including multiple content changes). Suggestion #2 would just work 
around the rearrangement behavior.


_______________________________________________

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

Reply via email to