title: Trying to expand/collapse UITableViewCell from a UIButton on the custom cell
body: <p>I have a UITableView populated with custom UITableViewCells.  Within those custom cells, I have a UITextField and a "See More" UIButton.  The purpose of the UIButton is to dynamically expand that particular UITableCell when the user wishes to read more of the text.  In the same way, when the user wishes to return to the original size, the user clicks the Button again, and the UITableViewCell will shrink to the original size.</p>
  
  <p>Since the cell isn't being selected, I setup an IBAction within the Custom Cell like such:</p>
  
  <p>//Within CustomCell.m</p>
  
  <pre><code>- (IBAction)showMoreText:(id)sender
  {
      //instance bool variable to flag whether the cell has been resized
      self.hasBeenResized = YES;
  
      //turn off mask to bounds, otherwise cell doesnt seem to resize
      [[self.cellView layer] setMasksToBounds:NO];
  
      // Calculate the new sizes and positions for the textView and the button 
      CGRect newTextViewFrame = self.textView.frame;
      newTextViewFrame.size.height = self.textView.contentSize.height;
      self.textView.frame = newTextViewFrame;
  
      CGFloat bottomYPos = self.textView.frame.origin.y + self.textView.frame.size.height;
      CGRect buttonFrame = self.showMoreButton.frame;
      buttonFrame.origin.y = bottomYPos;
      self.showMoreButton.frame = buttonFrame;
  
      // Call begin and end updates
      [(UITableView*) self.superview beginUpdates];   
      [(UITableView*) self.superview endUpdates];
  
      // Set mask and put rounded corners on the cell
      [[self.cellView layer] setMasksToBounds:YES];
      [[self.cellView layer] setCornerRadius:10.0];
  }
  </code></pre>
  
  <p>Following this, I have this in my ViewController class:</p>
  
  <pre><code>// Within ViewController.m
  - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      NSLog(@"heightForRowAtIndexPath");
  
      CustomCell *cell = (CustomCell*)[self tableView:tableView cellForRowAtIndexPath:indexPath];
  
      if([cell hasBeenResized] == NO)
      {
          return cell.frame.size.height + 20;
      }
      else
      {
          return cell.frame.size.height + cell.textView.frame.origin.y + cell.textView.frame.size.height + cell.showMoreButton.frame.size.height + 20;
      }
  }
  </code></pre>
  
  <p>What happens now is I can see the custom cell change the size of its textview, however, the table does not update the row height for that particular cell.  Checking on the If-else statement there, it appears that hasBeenResized is always false, even though I set it to YES within the IBACtion of the CustomCell.</p>
  
  <p>I have looked at other solutions here, but they all seem to involve didSelectRowAtIndexPath, which I cannot use in this instance (I have another behavior for the cell when it is selected).</p>
  
  <p>Am I doing this completely wrong?  Ideally, what I would like to do is to have the "Show More" button animate downwards as the textview is expanded and vice versa when it's collapsed.</p>
  
  <p>Thank you!</p>