1
votes

I have a simple UITableViewController, tableview setup as static, I have only one UITableViewCell inside it, UITableViewCell has one UIImageView and one label inside it.

enter image description here

Constraints added are as follows

enter image description here

When I run this app , everything looks fine except the image doest stay square that is UIIMageView looses its width and height constraints and shows the entire image. Scale type used is Aspect Fill. Not sure whats going on attached is the result

enter image description here

How can I make UiImageView to follow constraints ?

1
It looks it is not [testPic]-19-[label]. Was there any constraint conflict warning? What happen if you set clipsToBounds on the image view?Ryan
I think you should use either Width and height or Top/Bottom/Left/Right. If you use both you will get a weird result thereJuan Curti
Your constraints aren't fine as well. You're assigning the bottom constraint for both imageview and label. It will create conflicts.Bhavuk Jain

1 Answers

1
votes

Set clipsToBounds to true from the storyboard or you can also set it programmatically as:

imageView.clipsToBounds = true;

This will resolve your issue.