ios开发之单位时间内限制button的点击次数
-(void)timeEnough:(UIButton *)btn
{
btn.selected = NO;
}
-(void)btnClick:(UIButton *)btn
{
if (btn.selected)return;
btn.selected = YES;
[self performSelector:@selector(timeEnough:) withObject:nil afterDelay:3.0];
//你要实现的button点击事件
}
这样的效果就是该button在3秒内只能触发一次点击事件,防止button点击频率过快.