• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: updating UI during long loop using cocoa objective-c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: updating UI during long loop using cocoa objective-c


  • Subject: Re: updating UI during long loop using cocoa objective-c
  • From: Bob Smith <email@hidden>
  • Date: Mon, 2 Apr 2007 14:40:42 -0700


On Apr 2, 2007, at 7:53 AM, Keary Suska wrote:

However, when using beginModalSession/runModalSession you can call the main
run loop after runModalSession using:
[[NSRunLoop currentRunLoop] runUntilDate:
[NSDate dateWithTimeIntervalSinceNow:0.1]];


This trick has many (desirable) side effects, one of which is releasing the
main autorelease pool.

But it may have one very un-desireable side-effect; it will cause events to be handled for _all_ windows in the app, not just the one targeted by the modal session. The whole point of a modal session is to "lock down" the UI so your app responds to only very limited user input, i.e. a "Cancel" button, so you can perform a time-consuming update of the rest of the UI without having to deal with user actions on the affected views. (That's more or less the definition of "modal".) If you are going to iterate the run loop in normal mode anyway, why bother with the modal session at all?


Bob S.

_______________________________________________

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


References: 
 >Re: updating UI during long loop using cocoa objective-c (From: Keary Suska <email@hidden>)

  • Prev by Date: Re: optimizing background image drawing with -drawRect
  • Next by Date: Re: NSObjectController can't observe NSArrayController's selection?
  • Previous by thread: Re: updating UI during long loop using cocoa objective-c
  • Next by thread: Re: updating UI during long loop using cocoa objective-c
  • Index(es):
    • Date
    • Thread