Zeebok
Zeebok

Reputation: 388

Alignment UIImageView to left with Aspect Fit in xib

I want to align my images in UIImageview to the left. I am using Aspect fit mode. How can i achieve the goal using autoresiging constraints. What i have done is asenter image description here

I want to align this little logo to the left. enter image description here

Is there any way to set it using constraints and struts. I want like this enter image description here

Upvotes: 1

Views: 631

Answers (1)

Zeebok
Zeebok

Reputation: 388

I have done it programmatically. But still to head to set these constraints using ui-builder. If anyone know please share your knowledge with us.

CGFloat desiredHeight = .20 * self.logoImagesContainer.frame.size.height;
CGFloat scaleFactor = image.size.height/desiredHeight;
CGFloat desiredWidth = image.size.width / scaleFactor;
self.logoImageView.frame = CGRectMake(0, 0, desiredWidth, desiredHeight);

Upvotes: 1

Related Questions