i have 2 uibuttons, 1 on top of other, in superview height can resized. 2 buttons should have constant vertical spacing between them, top , bottom spacing should resize 2 buttons stay centered in superview resizes.
i tried creating 2 less-than-or-equal constraints (with equal priority) on spacing superview each button, constant vertical spacing between buttons, shown below:
(the reason why it's less-than-or-equal here because view defined @ given height in ib 4" screens, can shrunk 3.5" screens.) however, doesn't trick, can see screenshot while app running:
it's if want able tell autolayout 2 constraints should have equal values, if both set "less-than-or-equal". there way i'm trying do, or perhaps better way?
this trivial in ib.
1) ⌃ drag button1 top. select "center horizontally in container".
2) ⌃ drag button1 left. select "center vertically in container".
3) same button2.
4) thing left size buttons because looks like.
this trivial.
5) ⌃ drag button1 left. select "leading space container margin".
6) ⌃ drag button1 right. select "trailing space container margin".
7) exact same thing button2.
the finished product, looks (nb didn't quite center them, have enough):
Comments
Post a Comment