Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 2.11 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. UIButtons will not fade out during animation block
  2. -(IBAction)answerButtonPressed:(UIButton *)sender {
  3. NSLog(@"Game Question Answer Pressed: %i", sender.tag);
  4. NSLog(@"%@", sender.titleLabel.text);
  5.  
  6. int selectedAnswer =0;
  7. selectedAnswer = [question.answer intValue];
  8.  
  9. if (selectedAnswer == sender.tag) {
  10.     NSLog(@"GameQ %@ is the correct answer", sender.titleLabel.text);
  11.  
  12.     //self.toggleView;
  13.  
  14.     [labelA setAlpha:0];
  15.     [labelB setAlpha:0];
  16.     [labelC setAlpha:0];
  17.     [labelD setAlpha:0];
  18.  
  19.  
  20.     /*
  21.     [buttonA setAlpha:0];
  22.     [buttonB setAlpha:0];
  23.     [buttonC setAlpha:0];
  24.     [buttonD setAlpha:0];
  25.  
  26.     [buttonA setHidden:YES];
  27.     [buttonB setHidden:YES];
  28.     [buttonC setHidden:YES];
  29.     [buttonD setHidden:YES];
  30.      */        
  31.     [sender setAlpha:1];
  32.     [sender setHidden:NO];
  33.  
  34.     [[UIApplication sharedApplication] beginIgnoringInteractionEvents];
  35.     [UIView beginAnimations:nil context:NULL];
  36.     [UIView setAnimationDuration:1.5];
  37.  
  38.     [UIView animateWithDuration:2.0
  39.                           delay:0.0
  40.                         options: UIViewAnimationCurveEaseOut
  41.                      animations:^{buttonA.alpha = 0;}
  42.                      completion:nil];
  43.  
  44.     [UIView setAnimationDelegate:[UIApplication sharedApplication]];
  45.     [UIView setAnimationDidStopSelector:@selector(endIgnoringInteractionEvents)];
  46.  
  47.     [UIView commitAnimations];
  48.        
  49. [UIView animateWithDuration:2.0
  50.                           delay:0.0
  51.                         options: UIViewAnimationCurveEaseOut
  52.                      animations:^{buttonA.alpha = 0;}
  53.                      completion:nil];
  54.  
  55.     [UIView animateWithDuration:2.0
  56.                           delay:0.0
  57.                         options: UIViewAnimationCurveEaseOut
  58.                      animations:^{labelA.alpha = 0;}
  59.                      completion:nil];
  60.        
  61. [UIView beginAnimations:nil context:NULL];
  62. [UIView setAnimationDuration:1.5];
  63.  
  64. buttonA.alpha = 0;
  65.  
  66. [UIView commitAnimations];
  67.        
  68. [UIView animateWithDuration:2.0
  69.                       delay:0.0
  70.                     options: UIViewAnimationCurveEaseOut
  71.                  animations:^{buttonA.alpha = 0;}
  72.                  completion:nil];