【发布时间】:2016-03-20 03:05:42
【问题描述】:
我有一个停止时钟应用程序,希望在最初按下 startCountButton 按钮时禁用它,然后在按下 stopCountButton 按钮后再次启用它,以便只能按下开始按钮一次。这是我的代码
- (IBAction)startCount:(UIButton*)sender {
countInt = 0;
self.label.text = [NSString stringWithFormat:@"%i", countInt];
timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(countTimer) userInfo:nil repeats:YES];
}
- (IBAction)stopCount:(UIButton*)sender {
countInt = 0;
[timer invalidate];
}
-(void)countTimer {
countInt += 1;
self.label.text = [NSString stringWithFormat:@"%i", countInt];
}
对我需要添加的内容有什么帮助吗?我不想更改文本,只是禁用它
【问题讨论】:
-
你有什么问题?是什么阻止了你做你所说的?
标签: ios objective-c