iphone NStimer在2秒内启动 [英] iphone NStimer start in 2 seconds
本文介绍了iphone NStimer在2秒内启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图让我在启动它后2秒运行一段代码。
I am trying to have a block of code run 2 seconds after I 'start' it.
我认为NSTimer可以做到这一点,但无法理解out。
I think the NSTimer can do this but can't figure it out.
推荐答案
以下将满足您的需求:
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval: 2
target:self
selector:@selector(handleTimer:)
userInfo:nil
repeats:NO];
然后委托功能:
-(void)handleTimer: (NSTimer *) timer
{
//code
}
这篇关于iphone NStimer在2秒内启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文