title: iOS 8 self sizing cells with changing height
body: <p>I created a tableview with self-sizing UITableViewCells using </p>
  
  <p><code>tableview.rowHeight = UITableViewAutomaticDimension;</code> </p>
  
  <p>For testing a created a single <code>UIView</code> and added it to <code>cell.contentView</code> with the following constraints. (using masonry)</p>
  
  <pre><code>- (void)updateConstraints {
      UIView *superview = self.contentView;
  
      if (!_didSetupConstraints) {
          [self.testView mas_makeConstraints:^(MASConstraintMaker *make) {
              make.top.equalTo(superview);
              make.height.equalTo(@10.0f);
              make.left.equalTo(superview);
              make.right.equalTo(superview);
              make.bottom.equalTo(superview);
          }];
  
          _didSetupConstraints = YES;
      }
  
      [super updateConstraints];
  }
  </code></pre>
  
  <p>When i select a row i like to change the height of the selected cell. I do this by:</p>
  
  <pre><code>- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
      [super setSelected:selected animated:animated];
  
      [self.testView mas_updateConstraints:^(MASConstraintMaker *make) {
          if (selected) {
              make.height.equalTo(@100);
          }
          else {
              make.height.equalTo(@10);
          }
      }];
  
      [UIView animateWithDuration:0.3f animations:^{
          [super layoutIfNeeded];
      }];
  }
  </code></pre>
  
  <p>It seems to work but, xcode complaints with the following error:</p>
  
  <p><code>Unable to simultaneously satisfy constraints.</code></p>
  
  <p>Then problem is that <code>contentView</code> is creating a height constaint on its own (because <code>contentView.translatesAutoresizingMaskIntoConstraints = YES;</code> per default). </p>
  
  <p>So when updateConstraints is first run, the system will create a height constraint on <code>contentView</code> equal to <code>10.0f</code></p>
  
  <p>afterwards when <code>setSelected...</code> is called i alter the height of my <code>testView</code> so theres a conflict between <code>testView.height</code> (100.0f) and <code>contentView.height</code> (10.0f) and since <code>testView</code> is attached to the bottom of <code>contentView</code> (in order for self-sizing cells to work) it gives and error.</p>
  
  <p>I tried setting <code>contentView.translatesAutoresizingMaskIntoConstraints = NO;</code> but then it seems the UITableViewCell cant really figure out a proper size for the cell. (sometimes it too wide / too small) etc. </p>
  
  <p>What is the proper way to implement self-sizing cells which can have their height changed dynamicly?</p>