1
A
回答
2
将这个界面中的任何
@interface ViewController : UIViewController {
NSTimer *timer;
int seconds;
}
@property(nonatomic, strong) NSTimer *timer;
这在您的实现在你需要它
- (void)viewDidLoad
{
[super viewDidLoad];
self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerTick:) userInfo:nil repeats:YES];
seconds = 1;
}
- (void)timerTick:(id)sender{
NSLog(@"%d",seconds);
if (seconds == 15) {
[self.timer invalidate];
}
seconds++;
}
相关问题
- 1. 降低分数
- 2. 每次降低的NSTimer间隔运行
- 3. 将分数降至最低
- 4. 降低分辨率UIImage/UIImageView
- 5. MPI分钟功能降低
- 6. 下降最低分程序
- 7. 降低JSON数据
- 8. Clojure的:降低对适用
- 9. 针对特定类别降低Solr的分数
- 10. 降低
- 11. 主成分分析和功能降低
- 12. OpenMDAO 1.x相关性降低
- 13. 通过IoC降低相关性
- 14. 相对于父母下降不居中
- 15. 降低iPhone相机图片的分辨率?
- 16. 降低矢量的维数
- 17. 降低类型参数
- 18. 降低python降价能力
- 19. 降低相对/规范路径的复杂性? (如何消除“..”?)
- 20. 相对布局不低于越来越
- 21. 降低功耗
- 22. 降低UITableView
- 23. 降低帧率
- 24. 降低C++
- 25. 如何降低
- 26. 降低帧率
- 27. 如何在不降低分辨率的情况下降低UIImage的质量?
- 28. C#Winform大小降低分辨率
- 29. 熊猫降低分类变量
- 30. 使用VB.net降低USB分区大小
没错,米尝试。其实我不知道如何保存NSTimer的每一秒钟,特别是变量 – Abha
然后创建一个计时器,每秒调用一次方法。让该方法将你的分数减1(假设时间现在为零,则停止该计时器)。 – Rob
这意味着你想保存每个减少第二个商店或什么..? –