ios - Auto layout isn't working as expected for laying out buttons? -


i'm creating scene in xcode in main.storyboard user able choose between 5 options (buttons) , when created auto layout horizontally center buttons, vertically space them 5 pixels apart:

on 3.5 inch screen, buttons take most of screen

on 4 inch screen, buttons take 3/4 of screen

on 4.7 inch screen, buttons take half of screen

it makes sense happening, created @3x, @2x, , normal sized (1x) images using prepo

the buttons have custom background image properties

how can 4 inch, 4.5 inch, , 5.5 inch screens on iphone display 3.5 inch screen buttons take most of screen?

set following constraints buttons.

  1. for 1st button set constant top space top layout guide (say 20px).
  2. for last button set constant bottom space bottom layout guide (say 20px).
  3. set equal heights buttons.

and have following constraints.

  1. align buttons horizontally centre
  2. vertical spacing between them 5px

so buttons adjust height take of screen space. try this.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -