On 7/18/12 1:15 AM, Mike Abdullah wrote:
When I call rearrangeObjects on the array controller, the result gets
rectified. However, even with automaticallyRearrangesObjects = NO, the
array controller rearranges automatically so when I rearrange manually
after setting the filter, I get two KVO change notifications for
arrangedObjects which can be very costly and I'd really like to avoid
that.

Any ideas on how to force NSArrayController to (1) either produce a correct
result automatically or (2) prevent to do any rearranging by itself when a
filterPredicate is set?

Try subclassing NSArrayController and providing a custom implementation of
-arrangeObjects:

Even if you do nothing but set a breakpoint and call super, it’ll give you a
better idea of quite what the rearrangement is doing, and what’s triggering
it.

Thanks for the suggestion. Subclassing and implementing -arrangeObjects: makes the rearrangement issue go away. As to why I have no idea. How can that be. The subclass implementation does this:

- (NSArray *)arrangeObjects:(NSArray *)objects
{
    return [super arrangeObjects:objects];
}

Setting a breakpoint there shows me that -arrangeObjects is called when I call -setFilterPredicate: and nothing suspicious happens.

Regards
Markus
--
__________________________________________
Markus Spoettl


_______________________________________________

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