user2695433 user2695433 - 6 months ago 8x
Swift Question

ImageView width not scaled to fill ParentView in Autolayout iOS

I have tried to fill the

to fill the Image to be shown like a Top Header (logo). But it appears to have a 20px gap at the leading and trailing end.

I have used Leading and trailing constraints
but it shows 20 px gap (padding). If I'm using
for leading and trailing contraints then it works well but the image seems to be stretched.

What should I do to overcome this weird issue?

I have even tried using Equal width contraints with Imageview and Parent View controller View, but still with no success.

dzk dzk

Remove the current leading and trailing constraints. Add them again, but uncheck the Constrain to margins option, and now enter 0 for both leading and trailing constraints.

That should fix it.