title: UIImageView inside UITableViewCell is laid out incorrectly in edit mode
body: <p>I have a fairly simple <code>UITableViewCell</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/DOkCU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DOkCU.png" alt="enter image description here"></a></p>
  
  <p>Nothing extraordinary, but I ran into an issue. Whenever I enable the edit mode, the position and size of <code>UIImageView</code> change, <em>completely ignoring the constraints that pin it to the edges of its superview</em> (the one with blue background):</p>
  
  <p><a href="https://i.stack.imgur.com/wRmKd.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wRmKd.gif" alt="enter image description here"></a></p>
  
  <p>The superview is laid out correctly:</p>
  
  <p><a href="https://i.stack.imgur.com/nhjou.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nhjou.gif" alt="enter image description here"></a></p>
  
  <p>I expected to see messages about broken constraints in the system log, but there is nothing of the sort.</p>
  
  <p><strong>Why does this happen and how do I fix it?</strong></p>
  
  <p>Here's a project that reproduces the issue: <a href="https://www.icloud.com/iclouddrive/0NvLeUettZub5uQIXUM4p0bGw#TestApp" rel="nofollow noreferrer">https://www.icloud.com/iclouddrive/0NvLeUettZub5uQIXUM4p0bGw#TestApp</a></p>
  
  <hr>
  
  <p><strong>EDIT:</strong> I tried calling <code>layoutIfNeeded()</code> on the image container when the edit mode is activated:</p>
  
  <pre><code>class NoteTableViewCell: UITableViewCell {
  
      override func setEditing(_ editing: Bool, animated: Bool) {
          super.setEditing(editing, animated: animated)
          noteImageView.superview?.layoutIfNeeded()
      }
  }
  </code></pre>
  
  <p>now the layout is incorrect even if I don't enable the edit mode.</p>
  
  <p><strong>EDIT 2:</strong> @Desdenova suggested that this might be caused by the horizontal <code>UIStackView</code>, but replacing it with equivalent constraints did not fix the problem.</p>