title: Selecting a cell shows a button and deselecting hides the button
body: <p>I want a button to show when i select a cell, when i select the same cell or another cell i want the button to hide. So one button should only be visible at a time.</p>
  
  <p>What i have:</p>
  
  <p><strong>in my .h file:</strong></p>
  
  <pre><code>@property (strong, nonatomic) NSIndexPath *isselectednow;
  </code></pre>
  
  <p><strong>and my .m file:</strong></p>
  
  <p><em>Viewdidload:</em></p>
  
  <pre><code>self.isselectednow = [NSIndexPath indexPathForRow:7 inSection:1];
  </code></pre>
  
  <p><em>cellForRowAtIndexPath:</em></p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
  
  
  static NSString *CellIdentifier = @"Cell";
  
   UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   if (cell == nil) {
   cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
   }
  
  
   //[cell addSubview:[self drawSeparationView:(indexPath.row)]];
  
   UILabel *DateName = (UILabel *)[cell viewWithTag:100100];
   DateName.textColor = [UIColor blackColor];
   //DateName.text = [NSString stringWithFormat:@"%ld",(long)indexPath.row ];
   DateName.text = objects[indexPath.row];
  
  UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
  [button addTarget:self
             action:@selector(buttonOnCellPressed:)
   forControlEvents:UIControlEventTouchDown];
  [button setTitle:@"Update" forState:UIControlStateNormal];
  button.frame = CGRectMake(DEVICE_SIZE.width - 60, 18, 55, 15);
  
  [cell addSubview:button];
  if ([indexPath compare:self.isselectednow] == NSOrderedSame) {
      button.hidden = NO;
  }
  else{
      button.hidden = YES;
  }
  
   UILabel *lbl1 = (UILabel *)[cell viewWithTag:100101];
   lbl1.textColor = UIColorFromRGB(0x141414);
   UILabel *lbl2 = (UILabel *)[cell viewWithTag:100102];
   lbl2.textColor = UIColorFromRGB(0x141414);
   UILabel *lbl3 = (UILabel *)[cell viewWithTag:100103];
   lbl3.textColor = UIColorFromRGB(0x141414);
   UILabel *lbl4 = (UILabel *)[cell viewWithTag:100104];
   lbl4.textColor = UIColorFromRGB(0x141414);
   UILabel *lbl5 = (UILabel *)[cell viewWithTag:100105];
   lbl5.textColor = UIColorFromRGB(0x141414);
  
   UITextField *breakfastName = (UITextField *) [cell viewWithTag:100200];
   breakfastName.attributedPlaceholder =
   [[NSAttributedString alloc]
    initWithString:@"Name here"
    attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x141414)}];
   breakfastName.textColor = UIColorFromRGB(0x141414);
   [breakfastName setDelegate:self];
   //[breakfastName addTarget:self action:@selector(textChanged:) forControlEvents:UIControlEventEditingChanged];
  
   UITextField *OutName = (UITextField *) [cell viewWithTag:100201];
   OutName.attributedPlaceholder =
   [[NSAttributedString alloc]
    initWithString:@"Name here"
    attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x141414)}];
   OutName.textColor = UIColorFromRGB(0x141414);
   [OutName setDelegate:self];
  
   UITextField *lunchName = (UITextField *) [cell viewWithTag:100202];
   lunchName.attributedPlaceholder =
   [[NSAttributedString alloc]
    initWithString:@"Name here"
    attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x141414)}];
   lunchName.textColor = UIColorFromRGB(0x141414);
   [lunchName setDelegate:self];
  
   UITextField *InName = (UITextField *) [cell viewWithTag:100203];
   InName.attributedPlaceholder =
   [[NSAttributedString alloc]
    initWithString:@"Name here"
    attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x141414)}];
   InName.textColor = UIColorFromRGB(0x141414);
   [InName setDelegate:self];
  
   UITextField *eveningName = (UITextField *) [cell viewWithTag:100204];
   eveningName.attributedPlaceholder =
   [[NSAttributedString alloc]
    initWithString:@"Name here"
    attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x141414)}];
   eveningName.textColor = UIColorFromRGB(0x141414);
   [eveningName setDelegate:self];
  
   UITextField *othersName = (UITextField *) [cell viewWithTag:100205];
   othersName.attributedPlaceholder =
   [[NSAttributedString alloc]
   initWithString:@"Name here"
   attributes:@{NSForegroundColorAttributeName:UIColorFromRGB(0x141414)}];
   othersName.textColor = UIColorFromRGB(0x141414);
  
  
  
   cell.clipsToBounds = YES;
   cell.accessoryType = UITableViewCellAccessoryNone;
   cell.backgroundColor = UIColorFromRGB(0xf3f0e9);
  </code></pre>
  
  <p>return cell;
   }</p>
  
  <p><em>didSelectRowAtIndexPath:</em></p>
  
  <pre><code>[tableView beginUpdates];
  if ([indexPath compare:self.isselectednow] == NSOrderedSame) {
      self.isselectednow = nil;
  }
  else{
      self.isselectednow = indexPath;
  }
  
  [tableView endUpdates];
  //[tableView reloadData];
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/51jXd.png" alt="enter image description here"></p>