0

What I want to do is: On the right (see the image below) you see a slim bar (it's a UIView). It's pinned 100 to the top, 100 to the bottom and 10 to the right. That works fine. The constraints I set to the gray bar

Then I added an UIImageView with some placeholder image of a mountain. I want it to be next to the gray bar. So I aligned the top, bottom and trailing to the gray bar and set a fixed width.

("view" is my gray bar)

the constraints I set to the UIImageView

Everything works fine. That's what it looks like in the storyboard and preview window:

What it looks like in the storyboard and preview window

It also looks the same in the simulator. Now, I changed the UIImage to "Aspect Fill". Nothing changed in the preview. But now the app inside the simulator looks weird:

What the app looks like with "Aspect Fill"

I don't know why, but it is ignoring the width I set and it also doesn't align to the gray bar anymore.

What can I do?

Please tell me If you need more information. I'm not sure what is important :)

Cœur
  • 37,241
  • 25
  • 195
  • 267
SwiftedMind
  • 3,701
  • 3
  • 29
  • 63

1 Answers1

1

set clipsToBounds to true property of UIImageView.

d4Rk
  • 6,622
  • 5
  • 46
  • 60
Bhadresh Mulsaniya
  • 2,610
  • 1
  • 12
  • 25