• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArrayController not rearranging correctly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArrayController not rearranging correctly


  • Subject: Re: NSArrayController not rearranging correctly
  • From: Quincey Morris <email@hidden>
  • Date: Wed, 18 Jul 2012 23:40:09 -0700

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 (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


  • Follow-Ups:
    • Re: NSArrayController not rearranging correctly
      • From: Markus Spoettl <email@hidden>
References: 
 >NSArrayController not rearranging correctly (From: Markus Spoettl <email@hidden>)
 >Re: NSArrayController not rearranging correctly (From: Markus Spoettl <email@hidden>)
 >Re: NSArrayController not rearranging correctly (From: Quincey Morris <email@hidden>)
 >Re: NSArrayController not rearranging correctly (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Re: NSArrayController not rearranging correctly
  • Next by Date: GCD question
  • Previous by thread: Re: NSArrayController not rearranging correctly
  • Next by thread: Re: NSArrayController not rearranging correctly
  • Index(es):
    • Date
    • Thread