I have a UITableViewCell that has vertical stack view in which I add a custom UIView called ProductView with xib and it has stack views, one of the stack view has just UIImageView that has AspectFit in it and I have given width and height to 80 for it because I don't want it to change when I try landscape mode.
The problem is if I add the height and width constraint I get the following warnings in console:
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600002a7a710 UIImageView:0x7fd532c27310.width == 80 (active)>",
"<NSLayoutConstraint:0x600002a7aa80 UILayoutGuide:0x600003028fc0'UIViewSafeAreaLayoutGuide'.trailing == UIStackView:0x7fd532c26e60.trailing (active)>",
"<NSLayoutConstraint:0x600002a7acb0 UIStackView:0x7fd532c26e60.leading == UILayoutGuide:0x600003028fc0'UIViewSafeAreaLayoutGuide'.leading (active)>",
"<NSLayoutConstraint:0x600002a79810 H:|-(10)-[UIStackView:0x7fd532c23740] (active, names: '|':UITableViewCellContentView:0x7fd532c235a0 )>",
"<NSLayoutConstraint:0x600002a79860 H:[UIStackView:0x7fd532c23740]-(10)-| (active, names: '|':UITableViewCellContentView:0x7fd532c235a0 )>",
"<NSLayoutConstraint:0x600002a40fa0 'fittingSizeHTarget' UITableViewCellContentView:0x7fd532c235a0.width == 375 (active)>",
"<NSLayoutConstraint:0x600002a7d9f0 'UISV-canvas-connection' UIStackView:0x7fd532c27180.leading == UIImageView:0x7fd532c27310.leading (active)>",
"<NSLayoutConstraint:0x600002a7da40 'UISV-canvas-connection' H:[UIImageView:0x7fd532c27310]-(>=0)-| (active, names: '|':UIStackView:0x7fd532c27180 )>",
"<NSLayoutConstraint:0x600002a7dfe0 'UISV-canvas-connection' UIStackView:0x7fd532c26ff0.leading == UIStackView:0x7fd532c27180.leading (active)>",
"<NSLayoutConstraint:0x600002a7e030 'UISV-canvas-connection' H:[UIStackView:0x7fd532c274e0]-(0)-| (active, names: '|':UIStackView:0x7fd532c26ff0 )>",
"<NSLayoutConstraint:0x600002a7e580 'UISV-canvas-connection' UIStackView:0x7fd532c26e60.leading == UIStackView:0x7fd532c26ff0.leading (active)>",
"<NSLayoutConstraint:0x600002a7e5d0 'UISV-canvas-connection' H:[UIStackView:0x7fd532c26ff0]-(0)-| (active, names: '|':UIStackView:0x7fd532c26e60 )>",
"<NSLayoutConstraint:0x600002a402d0 'UISV-canvas-connection' UIStackView:0x7fd532c23740.leading == Test.ProductView:0x7fd532c24770.leading (active)>",
"<NSLayoutConstraint:0x600002a40320 'UISV-canvas-connection' H:[Test.ProductView:0x7fd532c297d0]-(0)-| (active, names: '|':UIStackView:0x7fd532c23740 )>",
"<NSLayoutConstraint:0x600002a7e0d0 'UISV-fill-equally' UIStackView:0x7fd532c274e0.width == UIStackView:0x7fd532c27180.width (active)>",
"<NSLayoutConstraint:0x600002a403c0 'UISV-fill-equally' Test.ProductView:0x7fd532c25a20.width == Test.ProductView:0x7fd532c24770.width (active)>",
"<NSLayoutConstraint:0x600002a40460 'UISV-fill-equally' Test.ProductView:0x7fd532c26cd0.width == Test.ProductView:0x7fd532c24770.width (active)>",
"<NSLayoutConstraint:0x600002a40550 'UISV-fill-equally' Test.ProductView:0x7fd532c283a0.width == Test.ProductView:0x7fd532c24770.width (active)>",
"<NSLayoutConstraint:0x600002a405f0 'UISV-fill-equally' Test.ProductView:0x7fd532c297d0.width == Test.ProductView:0x7fd532c24770.width (active)>",
"<NSLayoutConstraint:0x600002a7e080 'UISV-spacing' H:[UIStackView:0x7fd532c27180]-(0)-[UIStackView:0x7fd532c274e0] (active)>",
"<NSLayoutConstraint:0x600002a40370 'UISV-spacing' H:[Test.ProductView:0x7fd532c24770]-(6)-[Test.ProductView:0x7fd532c25a20] (active)>",
"<NSLayoutConstraint:0x600002a40410 'UISV-spacing' H:[Test.ProductView:0x7fd532c25a20]-(6)-[Test.ProductView:0x7fd532c26cd0] (active)>",
"<NSLayoutConstraint:0x600002a404b0 'UISV-spacing' H:[Test.ProductView:0x7fd532c26cd0]-(6)-[Test.ProductView:0x7fd532c283a0] (active)>",
"<NSLayoutConstraint:0x600002a405a0 'UISV-spacing' H:[Test.ProductView:0x7fd532c283a0]-(6)-[Test.ProductView:0x7fd532c297d0] (active)>",
"<NSLayoutConstraint:0x600002a7ab20 'UIViewSafeAreaLayoutGuide-left' H:|-(0)-[UILayoutGuide:0x600003028fc0'UIViewSafeAreaLayoutGuide'](LTR) (active, names: '|':Test.ProductView:0x7fd532c26cd0 )>",
"<NSLayoutConstraint:0x600002a7abc0 'UIViewSafeAreaLayoutGuide-right' H:[UILayoutGuide:0x600003028fc0'UIViewSafeAreaLayoutGuide']-(0)-|(LTR) (active, names: '|':Test.ProductView:0x7fd532c26cd0 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600002a7a710 UIImageView:0x7fd532c27310.width == 80 (active)>
If I remove the height and the width constraint then I don't see any warnings in console but it starts having dimension issue on when landscape. Is there a proper way to handle this?