iOS7.0 NSTimer使用

今天看視頻教程,基於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];

能夠正常使用,不明覺厲,以後切記使用後者避免出錯。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章