On 2009 Dec 05, at 22:43, Jerry Krinock wrote:

> I tested a new build of an app today and found that, all of a sudden, 
> clicking the "+" button for a table view adds a new object but no longer 
> selects it.

The problem was that I was invoking the array controller's -newObject, *then* 
inserting it with

[arrayController insertObject:newObject
        atArrangedObjectIndex:([arrayController selectionIndex] + 1) ;

I didn't realize that -newObject had already inserted, so the effect this was 
to insert the same object into the content array twice.  Now I guess that when 
the Core Data model KVOed this view change, it registered a set containing only 
unique object, apparently the one that was not selected, and then when the 
array controller KVOed this model change, it deleted the one that was selected. 
 Very cute.

So, have no doubts about NSArrayController's "Select Inserted Objects".  It 
works.

_______________________________________________

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