使用UIButton的enabled或userInteractionEnabled 使用UIButton的enabled屬性, 在點擊後, 禁止UIButton的交互, 直到完成指定任務之後再將其enabled即可. [btn addTarget:self action:@selector(next ...
使用UIButton的enabled或userInteractionEnabled
使用UIButton的enabled屬性, 在點擊後, 禁止UIButton的交互, 直到完成指定任務之後再將其enabled即可.
[btn addTarget:self action:@selector(nextStop:) forControlEvents:UIControlEventTouchUpInside];
- (void)nextStop:(UIButton *)sender { sender.enabled = NO; [self btnClicked]; }
- (void)btnClicked { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ NSLog(@"btnClicked"); btn.enabled = YES; }); }