Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

UIImageView AspectFit mode with AutoLayout

LeiKanLeiKan CNMember
edited October 2015 in Xamarin.iOS

I use a container view for my UILabels and UImageViews.
Constraints:
1.constraint the first subview's top to container view's top.
2.constraint the last subview's bottom to container view's bottom.
3.constraint the height between subviews;
4.constraint UILabel and UIImageView's leading to container view's leading.
5.constraint UILabel and UIImageView width.

then Set the UIImageView contentmode = AspectFit.

With above constraints, the label and imageview have flexible height with their's content.
But the UIImageView is bigger than real image (blank area in the picture), how to use autolayout constraint UIImageView to the image's real size?
And the image is dynamic load, so I cannot set the UIImageView's frame.
Thanks in advance.

Best Answer

Answers

  • RomainLouisRomainLouis NZMember

    I'm having the same problem Lei.

    Have you found a solution ?

Sign In or Register to comment.