Updating views (threading?)
Updating views (threading?)
- Subject: Updating views (threading?)
- From: Marc Respass <email@hidden>
- Date: Sat, 7 Apr 2007 14:30:34 -0400
Hi All,
My application loads some data via a web service. There are five
different methods to call to load up all the data. The web services
block until done. What I have done is added a status view (a view
with a progress indicator and a text field). I load the status view
and add it as a sub view of the currentView. In order to get the
status to update, I call display on the current view like this
[loadingMessageText setStringValue:@"Loading..."];
[currentView performSelectorOnMainThread:@selector(display)
withObject:nil waitUntilDone:YES];
id response = [MyService loadStuff];
This does work perfectly. My other view is loaded, added to the sub
view, then displayed.
The problem I am having is that I recently started using MOKit and
the MOViewController. I like MOViewController a *lot*. My application
will potentially have lots of views and having a controller for each
view is very nice. However, my view is no longer updating. I thought
that I was asking the wrong object to update but I cannot figure out
which object I should ask to display and I think I have tried
everything. I looked through the source of MOViewController and
cannot find anything there although it may be buried in
NSWindowController.
My understanding of why calling display via
performSelectorOnMainThread: works is that the window is not updated
until the end of the event loop so using performSelectorOnMainThread:
effectively lets the loop end before continuing through my method and
the window gets updated.
Either I misunderstand the correct use of
performSelectorOnMainThread:withObject:waitUntilDone: or there's
something about using MOViewController that is preventing the window
from updating. I have considered some kind of notification like
viewHasCompletelyFinishedLoadingForReal but I don't know for sure
where to put that.
Can anyone help point me in the right direction? I definitely want to
continue to use MOViewController but I really want to provide better
status than the Spinning Beach Ball.
Thanks a lot
Marc
_______________________________________________
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