Benny Davidovitz
Benny Davidovitz

Reputation: 1202

NSPopButton Stops NSTimer on main thread during selection

I have multiple timers that working on the main thread.
And I have a NSPopButton.
And I experience a bad behavior, timers just don't work, starting from the point that the use open the pop button's menu until he close the menu.
Any Ideas?

Upvotes: 0

Views: 43

Answers (1)

Vin Gazoil
Vin Gazoil

Reputation: 2020

This is probably because your NSTimer is running on the UI thread. You should run it on another thread like so:

NSTimer *myTimer = …
[[NSRunLoop mainRunLoop] addTimer:myTimer forMode:NSRunLoopCommonModes];

Upvotes: 1

Related Questions