I have a fairly simple UITableViewCell:
Nothing extraordinary, but I ran into an issue. Whenever I enable the edit mode, the position and size of UIImageView change, completely ignoring the constraints that pin it to the edges of its superview (the one with blue background):
The superview is laid out correctly:
I expected to see messages about broken constraints in the system log, but there is nothing of the sort.
Why does this happen and how do I fix it?
Here's a project that reproduces the issue: https://www.icloud.com/iclouddrive/0NvLeUettZub5uQIXUM4p0bGw#TestApp
EDIT: I tried calling layoutIfNeeded() on the image container when the edit mode is activated:
class NoteTableViewCell: UITableViewCell {
override func setEditing(_ editing: Bool, animated: Bool) {
super.setEditing(editing, animated: animated)
noteImageView.superview?.layoutIfNeeded()
}
}
now the layout is incorrect even if I don't enable the edit mode.
EDIT 2: @Desdenova suggested that this might be caused by the horizontal UIStackView, but replacing it with equivalent constraints did not fix the problem.


