ios - How do I use auto layout to align images horizontal to each other -


screenshot

so here's problem, i'm attempting align 2 green images relative superview, retain same position on possible iphone screen sizes, noticed when pin trailing, leading, bottom , top edges of both superview, left image appears correctly right image appears squashed on iphones smaller widths (e.g 5, 4s, 5s).

i can assume constraints of left image inevitably affecting constraints of 1 on right. although i'm not new auto layouts, i've never had deal situation of nature before, changes need make ensure images appear on screens, ones smaller widths.

ps: reducing actual sizes of both images didn't solve issue either.

thanks.

update: space between images shrink/grow according screen size. space between them isn't goal, goal getting images appear trailing , leading superview shown in screenshot, not relative each other.

i haven't tried this, is:

left image:

  1. pin "left" , "top" edges superview.
  2. pin width , height

right image:

  1. pin "right" , "top" edges superview
  2. pin width , height

don't pin 2 images each other. also, don't pin right image's left edge or left image's right edge. there's no reason pin bottom edge either because can fix height (assuming want size of images remain fixed).


Popular posts from this blog