title: Add a subview to a UITableView cell's view
body: <p>I'm attempting to add a subview (which contains a UIDatePicker) to the view of a UITableView cell when that cell is selected. However, when I select that cell, the content of the subview is not being displayed. </p>
  
  <p>Below is where I check to see if the user selects the cell that I want to add the subview to:</p>
  
  <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
  {
      if (indexPath.section == SectionOne &amp;&amp; indexPath.row == RowOne &amp;&amp; self.datePickerIsShowing == NO){
  
          [self.RowOne addSubview:_datePicker];
          [self showDatePickerCell];
      } else{
          [self hideDatePickerCell];
      }
      [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
  }
  </code></pre>
  
  <p>Additionally, below is how I create the date picker and show it:</p>
  
  <pre><code>- (void)createDatePicker{
      _datePicker = [[UIDatePicker alloc]initWithFrame:CGRectMake(0, 0, 100, 20)];
      _datePicker.datePickerMode = UIDatePickerModeTime;
      _datePicker.clipsToBounds = YES;
      _datePicker.backgroundColor = [UIColor colorWithRed:0.922 green:0.937 blue:0.949 alpha:1];
  }
  
  
  - (void)showDatePickerCell {
      self.datePickerIsShowing = YES;
      self.datePicker.hidden = NO;
      [self.tableView reloadData];
      NSLog(@"Show date picker");
  }
  </code></pre>
  
  <p>And below is how I set the selected row to be the required height to show the date picker:</p>
  
  <pre><code>- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
      CGFloat rowHeight = self.tableView.rowHeight;
          if (indexPath.section == SectionOne &amp;&amp; indexPath.row == RowOne &amp;&amp; self.datePickerIsShowing == YES){
                  rowHeight = kDatePickerCellHeight;
      }
      else{
          rowHeight = self.tableView.rowHeight;
      }
      return rowHeight;
  }
  </code></pre>