Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rossipoo

macrumors regular
Original poster
Jun 7, 2009
109
0
How can I keep my timers in the runloop firing while the window is being resized? timers in the default run loop will not fire during resize.
 
Did you try adding the timer to the runloop with NSEventTrackingRunLoopMode or NSRunLoopCommonModes?
 
That could be it, I will try that. I've never used any others beside the default before.
 
I solved the issue using NSRunLoopCommonModes.

I was using the timer to update the content of a view. It changed an ivar and then set the needsDisplay attribute. Unfortunately, the needsDisplay attribute seems to only used by the mainRunLoop. During a live resize, it is never checked. My view content would only redraw when the frame of the view changed; if I just held the resize-corner in one place, it would never update.

I changed the timer to instead call display rather than setNeedsDisplay, which forces a redraw without waiting to return to the runloop.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.