我在用
[NSTimer scheduledTimerWithTimeInterval:0.1f
target:self
selector:@selector(update)
userInfo:nil
repeats:YES];
我不想再把这个计时器称为“一”了。
viewDidDisappear
我怎样才能做到这一点?无效?
宣布NSTimer *myTimer
在 .h 文件中。
像汤姆说的那样分配实例
myTimer = [NSTimer scheduledTimerWithTimeInterval:0.1f
target:self
selector:@selector(update)
userInfo:nil
repeats:YES];
停止使用此功能并使之无效
- (void) viewDidDisappear:(BOOL)animated
{
[myTimer invalidate];
myTimer = nil;
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)