我有以下方法
-(void) showDie: (int) num;{
// do something
}
我想以 0.5 秒的时间间隔调用该方法。到目前为止,我有以下
SEL runShowDie;
[runShowDie performSelector:@selector(showDie:) withObject:rand];
[NSTimer scheduledTimerWithTimeInterval:.5 target:self selector:runShowDie userInfo:nil repeats:NO];
我做错了什么?
最佳答案
您将重复:否在此行中设为是
[NSTimer scheduledTimerWithTimeInterval:.5 target:self selector:@selector(showDie:) userInfo:[NSString stringWithFormat:@"%d",rand] repeats:YES];
关于ios - 以时间间隔执行选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18399823/