I have an IBAction button that I would like to enable after a 30 second delay. the button would be in the view but disabled for 30 secs.
Does anyone know how I would go about doing this?
Here's what I have - a simple IBAction that plays some audio:
-(IBAction) playSound:(id)sender {
[theAudio play];
}
You can use this:
- (IBAction)playSound:(id)sender
{
[theAudio play];
UIButton *theButton = (UIButton *) sender;
theButton.enabled = NO;
[self performSelector:@selector(enableButton:) withObject:theButton afterDelay:30.0];
}
- (void)enableButton:(UIButton *)button
{
button.enabled = YES;
}
Assuming that you want to disable the button when it gets pressed.