title: How to keep UIButton state selected in UITableView when you have multiple buttons?
body: <p>I have a table View containing buttons. What I want to do is, I want to keep tapped button(s) in selected state until they are tapped again (That's supposed to deselect them). It's like a Check Box to be honest. Simple, Right?<br>
  But the problem is, because of using single boolean flag to see whether button is pressed for the first time or second time, Things get messy. e.g. i click button one, then i click button two, now I want to deselect button one so I click it again but it doesn't deselect because Flag is set to YES (Though it does deselect on clicking once again). </p>
  
  <p>Is there a way to avoid this and achieve the desired result in just one click? 
  screenshot: <a href="http://i60.tinypic.com/1z51653.png" rel="nofollow">http://i60.tinypic.com/1z51653.png</a>
  This is what I'm doing:</p>
  
  <pre><code>-(void) btnStateChanged: (UIButton *) btnProblem
  {
      static BOOL btnPressedFirstTime=YES;
      if(btnProblem.selected==YES || btnProblem.highlighted==YES)
      {
          if(btnPressedFirstTime==YES)
          {
              [btnProblem setBackgroundImage:[UIImage imageNamed:@"sc123_button_hover"] forState: UIControlStateNormal];
              btnPressedFirstTime=NO;
          }
          else if(btnPressedFirstTime==NO)
          {
              [btnProblem setBackgroundImage:[UIImage imageNamed:@"sc123_button"] forState: UIControlStateNormal];
              btnPressedFirstTime=YES;
          }
      }
      [[NSUserDefaults standardUserDefaults] synchronize];
  }
  </code></pre>