SHARE
TWEET

Untitled

a guest Feb 19th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (IBAction)btnPlaySound:(id)sender {
  2.     CFBundleRef mainBundle = CFBundleGetMainBundle();
  3.     CFURLRef soundFileUrlRef;
  4.     soundFileUrlRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"", CFSTR(""), NULL);
  5.     UInt32 soundID;
  6.     AudioServicesCreateSystemSoundID(soundFileUrlRef, &soundID);
  7.     AudioServicesPlaySystemSound(soundID);
  8. }
  9.    
  10. - (IBAction)buttonPressed:(id)sender
  11. {
  12.     myTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerAction) userInfo:nil repeats:YES];
  13. }
  14.  
  15. - (void)timerAction
  16. {
  17.  
  18.     if (myButton.userInteractionEnabled == YES) {
  19.         //do something
  20.     }
  21.  
  22.     if ([myButton.tag == 0) {
  23.         [myTimer invalidate];
  24.         [myButton setTag:2];
  25.         myButton.userInteractionEnabled = YES;
  26.     }else{
  27.         myButton.userInteractionEnabled = NO;
  28.         int currentTime = myButton.tag;
  29.         int newTime = currentTime - 1;
  30.         [myButton setTag:newTime];
  31.     }
  32.  
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top