title: Different images for highlighted UIButton state
body: <p><br>
  I need <strong>2</strong> different images for highlighted state for an <code>UIButton</code>.</p>
  
  <p>I've these lines of code:</p>
  
  <pre><code>- (IBAction)buttonPressed:(id)sender
  {
      UIImage *followImageHighlighted = [UIImage imageNamed:@"follow-hilite.png"];
      UIImage *unfollowImageHighlighted = [UIImage imageNamed:@"unfollow-hilite.png"];
      if ([sender isSelected]) {
          // set this image for the next time the button will pressed
          [sender setImage:unfollowImageHighlighted forState:UIControlStateHighlighted];
      } else {
          // set this image for the next time the button will pressed
          [sender setImage:followImageHighlighted forState:UIControlStateHighlighted];
      }
  }
  
  - (void)viewDidLoad
  {
      // ...
      UIImage *followImage = [UIImage imageNamed:@"follow.png"];
      UIImage *unfollowImage = [UIImage imageNamed:@"unfollow.png"];
      [self.followButton setImage:followImage forState:UIControlStateNormal];
      [self.followButton setImage:unfollowImage forState:UIControlStateSelected];
  }
  </code></pre>
  
  <p>The problem is that every time I press the button I see the highlighted image <code>follow-hilite.png</code>. </p>
  
  <p>Can't I change the highlighted image for a button on the road?</p>
  
  <p>I think this is a bad limitation because when the button is selected (thus, "Following") and an user press it, he see the default image, then when it touch up the image is that for selected state and when the network operation is completed then the button image switch correctly to the selected one.</p>
  
  <p>Ideas?</p>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>- (IBAction)followButtonTapped:(id)sender
  {
      BOOL isFollowed = [sender isSelected];
      NSString *urlString = isFollowed ? kUnfollowURL : kFollowURL;
      // operation [...]
      [self.followButton setSelected:(isFollowed) ? NO : YES];
      self.user.followed = !isFollowed;
  }
  </code></pre>
  
  <p>I explain better the problem:</p>
  
  <ul>
  <li>button in default state: black text on white background</li>
  <li>button in selected state: white text on black background</li>
  </ul>
  
  <p>If the target user is not followed, the button is in default state and if I try to press it I see the correct highlighted image.</p>
  
  <p>BUT if the target user is followed and the button is in selected state, if I try to press it (and hold the finger) I see the button with black text on white background. This is very ugly and this is my problem.</p>