title: set selected/unselected image one at a time uitableview cell in sectioned table
body: <p>i m having a simple section table view. I have added a button at the left side of image.This button is selectable.Only one button (each cell have single button of same type) can be selected at a time and selected button background image changes to a specific selected image, others button back ground image changes to deselect image.If you tap again on selected image it remains selected.
  How ever i am not getting correct behaviour.
  code:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
  //  UITableViewCell *cell=nil;
  CustomCellMasterCustomer *cell=nil;
  
  static NSString *cellIdentifier=@"Locations";
  Customer *mCustomer;
  cell=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
  
  if(cell==nil){
  //      cell=[self reusableContentWithIdentifier:cellIdentifier];
      cell=(CustomCellMasterCustomer *)[self reusableContentWithIdentifier:cellIdentifier];
  
  }
  
  UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  button.tag = indexPath;
  [button setBackgroundImage:[UIImage imageNamed:@"cellLeftImageDisabled.png"] forState:UIControlStateNormal];
  [button setFrame:CGRectMake(10, 5, 36, 30)];
  [button addTarget:self action:@selector(viewDetail:) forControlEvents:UIControlEventTouchUpInside];
  [cell.contentView addSubview:button];
  
  cell.aCustomer = mCustomer;//alok added
  
  if (indexPath == self.mPreviousIndex)
  {
      [button setBackgroundImage:[UIImage imageNamed:@"cellLeftImageEnabled.png"] forState:UIControlStateNormal];
  }
  else
  {
      [button setBackgroundImage:[UIImage imageNamed:@"cellLeftImageDisabled.png"] forState:UIControlStateNormal];
  
  }
  return cell;
  </code></pre>
  
  <p>}</p>
  
  <pre><code>-(void)viewDetail:(id)sender
  {
  CGPoint buttonOrigin = [sender frame].origin;
  // this converts the coordinate system of the origin from the button's superview to the table view's coordinate system.
  CGPoint originInTableView = [self.allCustomerTable convertPoint:buttonOrigin fromView:[sender superview]];
  
                               // gets the row corresponding to the converted point
                               NSIndexPath *rowIndexPath = [self.allCustomerTable indexPathForRowAtPoint:originInTableView];
  
  
  CustomCellMasterCustomer *cell = (CustomCellMasterCustomer *)[self.allCustomerTable cellForRowAtIndexPath:rowIndexPath];
  
  [self fillDetailViewWithCustomerInformation:cell.aCustomer];
  
  //change button background image
  
  
  UIButton *btn = (UIButton *)sender;
  
  [btn setBackgroundImage:[UIImage imageNamed:@"cellLeftImageEnabled.png"] forState:UIControlStateNormal];
  self.mPreviousIndex = rowIndexPath;
  [self.allCustomerTable reloadData];
  </code></pre>
  
  <p>}</p>
  
  <p>what wrong i am doing,
  any suggestion</p>