title: iPhone iOS 4 UIButton toggle highlighted state on and off
body: <p>I got a UIButton with style "Info Dark" set up in interface builder in my iPhone 4 app. One of the properties of the button is "Highlighted", which displays a white highlight around the button.</p>
  
  <p>I would like to toggle this white highlight on and off, indicating if the button function is active or not. </p>
  
  <p>The button is linked for "Touch up inside" event in the interface builder with this callback:</p>
  
  <pre><code>infoButton.highlighted = !infoButton.highlighted;
  </code></pre>
  
  <p>After the first touch, the highlight disappears and does not toggle as I expect it to. What else do I need to do to make the highlight toggle and display the state of the button?</p>
  
  <p>Thank you!</p>
  
  <p><strong>Update:</strong>
  When loaded from the interface builder, the button stays highlighted, even as the view appears/disappears. What causes this to happen is the "shows touch on highlight" interface builder property. If I assign the code above to another button, the info button highlights on and off as expected. However, the touches of the info button itself interfere with the above code, causing the button to lose the <strong>"touch" highlight</strong></p>
  
  <p>Update 2: I added another info button, directly below the first info button, in the interface builder and made it glow permanently. To create the appearance of the toggle, I hide and unhide the glowInfoButton below the real one. This works as expected:</p>
  
  <pre><code>    infoButton.highlighted = NO;
      glowInfoButton.highlighted = YES;
      glowInfoButton.enabled = NO;
      glowInfoButton.hidden = YES;
  
  - (IBAction)toggleInfoMode:(id)sender {
  //    infoButton.selected = !infoButton.selected;
      glowInfoButton.hidden = !glowInfoButton.hidden;
   }
  </code></pre>