On 7/12/2011 6:14 PM, Ken Thomases wrote:
On Jul 12, 2011, at 5:36 PM, James Walker wrote:

On 7/12/2011 2:04 PM, Ken Thomases wrote:

Invoking -setSortDescriptors: on the array controller does sort it (or should).
Back on 10.4, it may have been necessary to follow that with a call to 
-rearrangeObjects.

-[NSArrayController setSortDescriptors:] alone doesn't work for me even on 
10.6, but that combined with -[NSArrayController rearrangeObjects] does the 
trick.  That is, I set use setSortDescriptors: once, and use rearrangeObjects 
whenever I add new items to the table.

Is your array controller bound to its content, or are you setting that 
programmatically?  If it's bound, then it ought to rearrange its objects when 
they are added.  The fact that it doesn't suggests that you aren't updating the 
property to which it is bound in a KVO-compliant manner.

The table column is bound to the array controller using IB. I was adding new items using -[NSArrayController addObject:]. What's the better way?

Regards,
--
  James W. Walker, Innoventive Software LLC
  <http://www.frameforge3d.com/>
_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to