title: Changing UIButton background image on event
body: <p>When a <code>UISwitch</code> changes from 'OFF' to 'ON', I want the background image of a <code>UIButton</code> to change. I have the following code:</p>
  
  <pre><code>- (IBAction)switchValueChanged {
      if (Hard1ON.on) {
          UIImage *buttonImage = [UIImage imageNamed:@"red.jpg"];
          [Hard1 setImage:buttonImage forState:UIControlStateNormal];
          [self.view addSubview:Hard1];
          NSLog(@"Change");
      }
      else {
          UIImage *buttonImage = [UIImage imageNamed:@"white.jpg"];
          [Hard1 setImage:buttonImage forState:UIControlStateNormal];
          [self.view addSubview:Hard1];
      }
  }
  </code></pre>
  
  <p>When I hit the switch, the console logs correctly so I know that's working, however the background of the button doesn't change. </p>
  
  <p>For reference, <code>Hard1ON</code> is my <code>UISwitch</code> and <code>Hard1</code> is my <code>UIButton</code>.</p>