Sometimes the action is to prevent the user from responding to the next one at the end of a response. But some test users are going to be a little bit more mad. It's like this kind of malice is going to prevent.
Of course, there are some asynchronous operations that can be removed before they are called. Wait for callback and then enable. The button is not point in the process.
1, can use:
-(void) Timeenough
{
UIButton *btn= (uibutton*) [Self.view viewwithtag:33];
Btn.selected=no;
[Timer invalidate];
Timer=nil;
}
-(void) Btndone: (uibutton*) btn
{
if (btn.selected) return;
Btn.selected=yes;
[Self performselector: @selector (Timeenough) Withobject:nil afterdelay:3.0]; Use delay to limit.
To do something.
}
2, personally think this method is more useful.
-(void) todosomething: (ID) sender
{
Do the buttons here to do the things you want to do.
}
-(void) starbuttonclicked: (ID) sender
{
The task is canceled before the time of execution.
[Self- class] cancelpreviousperformrequestswithtarget:self selector:@selector (todosomething:) object:sender];
[self performselector:@selector (todosomething:) Withobject:sender afterdelay:0.2f];
}
For the second method, a Quick click N times, as long as each interval within 0.2 seconds of not responding to the operation, wait until the stop click to reach 0.2 seconds before execution. So set the response time to your own needs, and go crazy and respond only once.