[SOLVED] NSArrayController selects inserted NSManagedObject with delay
[SOLVED] NSArrayController selects inserted NSManagedObject with delay
- Subject: [SOLVED] NSArrayController selects inserted NSManagedObject with delay
- From: Camille GOUREAU-SUIGNARD <email@hidden>
- Date: Sun, 14 Jan 2007 18:11:27 +0100
I often use the insert: method on an arrayController (whose mode
is entity, and is set to select inserted objects).
In what situations are you using -[NSArrayController insert:] to
create a managed object from within code? Generally, you should
only use this as a user interface action; it's declared as an
IBAction, and methods that are declared as IBAction are generally
intended to manage the whole response to the user themselves; part
of this, as you've seen, is that they may need to delay certain
things for programmatic purposes even though there will be no
perceptible delay to the user.
To create a managed object in your code, use -[NSEntityDescription
insertNewObjectForEntityForName: inManagedObjectContext:] instead.
This will return the managed object, after invoking its -
awakeFromInsert, and you can do further things to it before
returning to the user.
OK, it works. Thanks a lot. i did not use it because I also had
instructions in the awakeFromInsert method and I thought it was not
triggered when not using the insert: method (because of the name).
Either you create the MO by using insert: via IB or
[NSEntityDescription insertNewObjectForEntityForName:
inManagedObjectContext:] in your code, awakeFromInsert is triggered.
Thanks again.
Camille
-- Chris
Et mon blog: www.lutin-ludique.com/bradype/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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