iOS7.0 NSTimer使用

来源:互联网 发布:一般医院用哪个数据库 编辑:程序博客网 时间:2024/06/11 07:42

今天看视频教程,基于IOS5的,里边在初始化NSTimer用的是

[NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(update) userInfo:nil repeats:YES];


使用后每次update方法只执行了一次,不过视频里是用的这个方法处罚的,之后改用

[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(update) userInfo:nil repeats:YES];

能够正常使用,不明觉厉,以后切记使用后者避免出错。

原创粉丝点击