Hello,
I have a sound that plays when a button is touched. 17 seconds later I want another action to be called using performSelector to stop the sound. If the first button is touched again before the 17 seconds have been reached I want the counter to restart. How can this be done?
Thanks,
Nick
I have a sound that plays when a button is touched. 17 seconds later I want another action to be called using performSelector to stop the sound. If the first button is touched again before the 17 seconds have been reached I want the counter to restart. How can this be done?
Code:
-(IBAction) push{
[sound play];
[self performSelector:@selector (stop) withObject:nil afterDelay:17.];
}
-(void) stop{
[sound stop];
}
Nick
Last edited: