gpt4 book ai didi

ios - 以时间间隔执行选择器

转载 作者:行者123 更新时间:2023-11-29 03:41:21 26 4
gpt4 key购买 nike

我有以下方法

-(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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com