正确发布NSTimer的方法? [英] Correct way to release NSTimer?

查看:76
本文介绍了正确发布NSTimer的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在dealloc方法中发布NSTimer的正确方法是什么?它是用以下代码创建的?

What is the correct way to release a NSTimer in my dealloc method ? It was created with the following code ?

-(void)mainTimerLoop {

     mainTimer = [NSTimer scheduledTimerWithTimeInterval:1/10
                                                  target:self 
                                                selector:@selector(gameLoop) 
                                                userInfo:nil
                                                 repeats:YES];
}

谢谢

推荐答案

你对NSTimer有一个非常好的答案我该怎么办?使用NSTimer?他们谈论停止重复的NSTimer做什么

you have a really good answer about NSTimer here How do I use NSTimer? there they talk about stoping a repeating NSTimer doing

[myTimer invalidate];

这篇关于正确发布NSTimer的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆