Hi,
When I apply constraints to my UIImageView, the image view's height expands larger than the area available even though I'm setting the width/height/top/trailing to its superview.
The layout is this:
- UITableViewCell
- UIScrollView
- custom UIView (xib / @IBDesignable - not sure if this is the issue)
- circleContainer (UIView) - Has constraints setup in Xcode
- circleView (UIView)
- imageView (UIImageView)
If I comment out the anchor/constraints code for imageView, the height is fine.
Do I need to call anything after setting the constraints on circleView? Any advice appreciated.
circleView.translatesAutoresizingMaskIntoConstraints = false
circleView.topAnchor.constraint(equalTo: circleContainer.topAnchor).isActive = true
circleView.heightAnchor.constraint(equalTo: circleContainer.heightAnchor).isActive = true
circleView.trailingAnchor.constraint(equalTo: circleContainer.trailingAnchor).isActive = true
circleView.widthAnchor.constraint(equalTo: circleView.heightAnchor).isActive = true
// imageView is the only subview of circleView
imageView.translatesAutoresizingMaskIntoConstraints = false
imageView.topAnchor.constraint(equalTo: circleView.topAnchor).isActive = true
imageView.heightAnchor.constraint(equalTo: circleView.heightAnchor).isActive = true
imageView.trailingAnchor.constraint(equalTo: circleView.trailingAnchor).isActive = true
imageView.widthAnchor.constraint(equalTo: imageView.heightAnchor).isActive = trueThanks in advance.