One Quickie


Giving the event loop some love (General->General)
Say you're in a callback environment in the main thread, but need to update the UI, like to update a progress meter. You can give the runloop a chance to do one flip by doing:
void giveSomeLove ()
{
    // give the app some love so it'll update the window
    [[NSRunLoop currentRunLoop] runUntilDate: [NSDate distantPast]];
} // giveSomeLove



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com