Re: How do I know when my Core Data app is up and running?
Re: How do I know when my Core Data app is up and running?
- Subject: Re: How do I know when my Core Data app is up and running?
- From: Matt Neuburg <email@hidden>
- Date: Wed, 04 Oct 2006 09:29:15 -0700
- Thread-topic: How do I know when my Core Data app is up and running?
On Tue, 03 Oct 2006 19:07:12 +0200, "Arthur C." <email@hidden>
said:
>>In a Core Data + Bindings application, there could be automatic fetching
>>at application startup due to an NSArrayController in "Entity" mode in the
>>MainMenu nib, or when an NSPersistentDocument is opened and contents
>>displayed in a window.
>
>Yes, that's right. In my case, it is an array controller in 'entity' mode.
>
>>Depending or what your "some initialization code" does, it can probably be
>>run at any reasonable time
>
>Now for instance, I would like to set the selection in my table view to a
>previously stored value at program startup.
>The applicationWill/DidFinishLaunching is too early. When the objects are
>fetched (monitoring awakeFromFetch), sometimes the arraycontroller is
>loaded, sometimes it is not. So that is not the right time either. When the
>table views are initialized (monitoring the
>tableViewIsChangingNotification), same thing. Sometimes the array controller
>is loaded, sometimes it's not. The order in which things are executed isn't
>fixed.
What I do is use delayed performance. This gives everything a chance to sync
up - your next event comes in when the data is loaded. So, here's how my
awakeFromNib goes:
[self->entries prepareContent];
[self performSelector:@selector(finishAwaking:) withObject:nil
afterDelay:0.1];
and then (in finishAwakening:):
[self->entries setSelectionIndex: (ct-1)];
[self->window makeKeyAndOrderFront:self];
Unfortunately I get the Spinning Cursor of Death while waiting for the data
to load, but that's a different matter. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden