开发者

Timer delayed by resizing window

开发者 https://www.devze.com 2023-03-13 12:15 出处:网络
I have a NSTimer who ticks every 0.x seco开发者_运维百科nds. I also have a button that enables to show or hide controls hereby resizing the window.

I have a NSTimer who ticks every 0.x seco开发者_运维百科nds. I also have a button that enables to show or hide controls hereby resizing the window.

I noticed however that by clicking the button and resizing the window significantly delays the timer, for example if i repeatedly click the resize button my timer my run several seconds late.

Can anybody advice me on how to fix this?


Try adding it to the common run loop modes:

// alloc/init your timer here
[[NSRunLoop currentRunLoop] addTimer:yourTimer forMode:NSRunLoopCommonModes];
0

精彩评论

暂无评论...
验证码 换一张
取 消