ios 防止按钮快速点击造成多次响应的避免方法。

- (void)starButtonClicked:(id)sender

{

    //先将未到时间执行前的任务取消。

    [[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(todoSomething:) object:sender];

    [self performSelector:@selector(todoSomething:) withObject:sender afterDelay:0.2f];

}

 

http://blog.csdn.net/fengsh998/article/details/11112885

posted @ 2015-11-24 09:12  lianhuaren  阅读(384)  评论(0编辑  收藏  举报