title: How do I update UIButton image in custom table cell after cellforrowatindexpath?
body: <p>I have a button in my tableview that is supposed to change after it is tapped. </p>
  
  <p>In my cellforrowatindexpath, I have </p>
  
  <pre><code> [cell.graphicButton addTarget:self action:@selector(changeGraphic:)forControlEvents:UIControlEventTouchUpInside];
  </code></pre>
  
  <p>which is supposed to call changeGraphic (which changes the graphic). The call is successful, but in changeGraphic the image doesn't change.</p>
  
  <pre><code>- (IBAction)changeGraphic:sender
  {
  
  
      buttonState++;
  // button state is an int, im not using BOOl because I have more than 2 images to change from, but for this question i only included 2
      if(buttonState == 2){
          buttonState = 0;
      }
      // 1 = travel time 2 =activity time 3 = total time
      if (buttonState == 0) {
  
  
  
           [cell.vicinitimeGraphicButton setBackgroundImage:[UIImage imageNamed:@"travelDistanceGraphicGreen.png"] forState:UIControlStateNormal];
      }
  
      if (buttonState == 1) {
  
  
           [cell.vicinitimeGraphicButton setBackgroundImage:[UIImage imageNamed:@"activityTimeGraphicGreen.png" ] forState:UIControlStateNormal];
      }
  
  [self.tableView beginUpdates];
  [self.tableView reloadData];
  [self.tableView endUpdates];
  </code></pre>
  
  <p>}</p>
  
  <p>When I log stuff inside the changeGraphic method, it returns fine. Am I updating the images of the UIButton correctly? </p>