I’m working on an application, There are several NSWindows in this application and one StatusItem in order to access any of NSWindows when they are not open. Some of these windows continuously updating their interface with new numbers and statuses. The problem is whenever I’m clicking the StatusItem in the System Status Bar it’s blocking the updates on the windows and I can’t see any updates until I close the StatusMenu.
I’m working on an application, There are several NSWindows in this application and one
Share
This is about Run Loop Modes.
Deferred operations that run on the main thread are typically scheduled for
NSDefaultRunLoopModeof the main run loop which means to not run when a menu or a modal dialog is open. You need to useNSRunLoopCommonModesinstead, which will allow them to run in both default and event tracking (menus, dialogs) modes.For example:
if you are using
NSTimerto fire update events, instead ofscheduledTimerWithTimeInterval, usetimerWithTimeIntervalin combination with[[NSRunLoop currentRunLoop] addTimer:theTimer forMode:NSRunLoopCommonModes].if you are using
performSelectorOnMainThread:withObject:waitUntilDone:, instead useperformSelectorOnMainThread:withObject:waitUntilDone:modes:, passing[NSArray arrayWithObject:NSRunLoopCommonModes]for themodes:argument.