0
這裏是我用來初始化計時器一個代碼:初始化計時器其他代碼後從未運行
self.timer = [NSTimer scheduledTimerWithTimeInterval:5.0f
target:self selector:@selector(tick:) userInfo:nil repeats:YES];
NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop];
[currentRunLoop run];
int a = 10;
調用後「[currentRunLoop運行];」,「一個INT = 10;」 (即使在通過定時器調用tick:方法之後)
爲什麼? 謝謝。
你爲什麼叫'currentRunLoop'開展工作? –
,因爲它不是主線程。 – Sergio