我的代码是:我的NSTimer的选择器不运行。为什么?
-(void) timerRun{...}
-(void) createTimer
{
NSTimer *timer;
timer = [NSTimer timerWithTimeInterval:1.0
target:self
selector:@selector(timerRun)
userInfo:nil
repeats:YES];
}
viewDidLoad
{
[NSThread detachNewThreadSelector:@selector(createTimmer)
toTarget:self withObject:nil];
...
}
当我调试,createTimer
运行正常,但该方法并没有timerRun
运行的方法?
'@selector(createTimmer)'大概只是一个错字? – Tommy
只是好奇你为什么使用另一个线程来创建定时器...是否由于某种原因,预计会长时间运行? – devios1