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.
- for 1st button set constant top space top layout guide (say 20px).
- for last button set constant bottom space bottom layout guide (say 20px).
- set equal heights buttons.
and have following constraints.
- align buttons horizontally centre
- vertical spacing between them 5px
so buttons adjust height take of screen space. try this.
Comments
Post a Comment