iOS解决按钮短时间内多次点击只触发一次事件方法

- (void)unisversalButtonAcrion:(UIButton *)sender
{
    [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(todoSomething:) object:sender];
    [self performSelector:@selector(todoSomething:) withObject:sender afterDelay:0.3f];
}

- (void)todoSomething:(UIButton *)sender {
    if (self.bindIngBankCarBlock) {
        self.bindIngBankCarBlock();
    }
}

 

posted on 2019-02-22 16:24  麦芽呀~  阅读(1605)  评论(0编辑  收藏  举报