看板 MacDev 關於我們 聯絡資訊
再補充一下NSRunLoop的使用時機: 1. Use ports or custom input sources to communicate with other threads. 2. Use timers on the thread. 3. Use any of the performSelector… methods in a Cocoa application. 4. Keep the thread around to perform periodic tasks. 摘自 http://0rz.tw/8745v (Threading Programming Guide) 基本上的原則就是,當你的Thread要做的工作, 有必要與別的thread做比較複雜的互動時,(例如,要在某個thread中動態增加工作) 就可以考慮使用NSRunLoop. 其他的情況,還是簡單一點,使用NSTimer與NSThread就好了。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 219.84.252.229