- (void)viewDidLoad
{
[super viewDidLoad];
UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
btn.tag=33;
btn.frame=CGRectMake(10, 10, 50, 50);
btn.backgroundColor=[UIColor blueColor];
[btn addTarget:self action:@selector(btnDone:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
- (void) btnDone:(UIButton*)btn
{
if(btn.selected) return;
btn.selected=YES;
[self performSelector:@selector(timeEnough) withObject:nil afterDelay:3.0]; //3秒后又可以处理点击事件了
NSLog(@"btnDone!");
}
- (void) timeEnough
{
UIButton *btn=(UIButton*)[self.view viewWithTag:33];
btn.selected=NO;
[timer invalidate];
timer=nil;
}
{
[super viewDidLoad];
UIButton *btn=[UIButton buttonWithType:UIButtonTypeCustom];
btn.tag=33;
btn.frame=CGRectMake(10, 10, 50, 50);
btn.backgroundColor=[UIColor blueColor];
[btn addTarget:self action:@selector(btnDone:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];
}
- (void) btnDone:(UIButton*)btn
{
if(btn.selected) return;
btn.selected=YES;
[self performSelector:@selector(timeEnough) withObject:nil afterDelay:3.0]; //3秒后又可以处理点击事件了
NSLog(@"btnDone!");
}
- (void) timeEnough
{
UIButton *btn=(UIButton*)[self.view viewWithTag:33];
btn.selected=NO;
[timer invalidate];
timer=nil;
}