title: UIButton setBackgroundImage and viewWillAppear
body: <p>Ok guys I got a problem with UIButton, maybe that´s simple to solve. I have a button with an IBAction toggleMusic which changes the background image.</p>
  
  <pre><code>-(IBAction)toggleMusic{
      if (gameAppDelegate.playMusic) {
          gameAppDelegate.playMusic = NO;
          [menuAudioPlayer stop];
          [botaoMusic setBackgroundImage:[UIImage imageNamed:@"bt_sound_off.png"] forState:UIControlStateNormal];
          [SoundManager playSoundFile:@"botao3" Format:@"wav" InLoop:NO];
  
      }
      else {
          gameAppDelegate.playMusic = YES;
          [menuAudioPlayer play];
          [botaoMusic setBackgroundImage:[UIImage imageNamed:@"bt_sound_on.png"] forState:UIControlStateNormal];
          [SoundManager playSoundFile:@"botao3" Format:@"wav" InLoop:NO];
  
      }
  }
  </code></pre>
  
  <p>This is working fine. playmusic (bool) is a stored variable, so everytime I turn the app off and then on, the app already knows if it should play music or not. this is also working fine. </p>
  
  <p>the problem is that I want to set the correct background image (music on/off) as soon as the app is turned on (not only when I click the button). so I put the following code on view will appear:</p>
  
  <pre><code>-(void)viewWillAppear:(BOOL)animated{
      if(gameAppDelegate.playMusic)
          [botaoMusic setImage:[UIImage imageNamed:@"bt_sound_on.png"] forState:UIControlStateNormal];
      else
          [botaoMusic setImage:[UIImage imageNamed:@"bt_sound_off.png"] forState:UIControlStateNormal];
  
  
  }
  </code></pre>
  
  <p>when I introduce this code, the app succesfully recognizes the correct background image when the view appears, but togglemusic ceases to alter the button background when I touch the button. It may be something silly, but I can´t figure out what I´m doing wrong...</p>