ios - Get same result with NSLayoutConstraint as with Autosizing -


in ui have 5 buttons @ bottom. autosizing applied every button on picutre:

enter image description here

i desired results:

enter image description here enter image description here

however, when tried autolayout in ib or in code this:

nsdictionary *viewsdictionary = nsdictionaryofvariablebindings(_button1, _button2, _button3, _button4, _button5); nsarray *constraints = [nslayoutconstraint                                   constraintswithvisualformat:@"|-[_button1]-[_button2]-[_button3]-[_button4]-[_button5]-|"                                   options:nslayoutformatalignallbaseline                                   metrics:nil                                   views:viewsdictionary]; [self.view addconstraints:constraints]; 

i this:

enter image description here

even when try set default width, don't behaviour expected.

you need set equal width constraint buttons , set horizontal space constraint between each buttons through ib.

to set equal height
* select buttons
* editor -> pin -> width equally

hope works well, worked me.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -