NSArrayController setSelectedObjects: not working with newly created objects
NSArrayController setSelectedObjects: not working with newly created objects
- Subject: NSArrayController setSelectedObjects: not working with newly created objects
- From: "Matteo Manferdini" <email@hidden>
- Date: Sun, 7 Dec 2008 17:29:31 +0100
Hi everyone,
I stumbled into another weird behaviour of Cocoa.
If I try to set as selected newly created objects into an
NSArrayController, the method does not work and the controller loses
its selection. The array controller is bound to a core data managed
object context. Here there is the code:
IBOutlet NSArrayController *arrayController;
/***/
NSManagedObject *newObject = [arrayController newObject];
[arrayController setSelectedObjects:[NSArray arrayWithObject:newObject]];
If I call [arrayController selectedObject] just before these two
lines, the array returned contains the actual selection, but if I call
it just after them, it returns an empty array.
I use setSelectedObjects: in another place of my code, on the same
array controller, passing the very same parameter, and there it works
perfectly. So it makes me guess that it does not work on just created
objects, but I wonder why.
I also tried to isolate the above code in an ad hoc project with just
those lines, just to make sure it was not some bug of mine, and it
still does not work.
Anyone has any hint?
Should I file a radar?
Thank you very much.
Cheers.
Matteo Manferdini
_______________________________________________
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