gpt4 book ai didi

ios - 在事件 iOS 上禁用和启用按钮

转载 作者:可可西里 更新时间:2023-11-01 04:33:58 25 4
gpt4 key购买 nike

<分区>

我有一个秒表应用程序,希望在最初按下 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];
}

对我需要添加的内容有什么帮助吗?我不想更改文本,只是将其禁用

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com