Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stretch two buttons horizontally across all devices AutoLayout

I'm attempting to have two buttons side by side that look correct across all devices but no matter what constraints I seem to add in I keep getting issues similar to this (one button larger then the other):

enter image description here

Any ideas what I'm doing wrong as far as adding in constraints? I'm not using code for this simply doing it through the InterfaceBuilder in Storyboard.

Constraints set:

Reply: Leading Space, Bottom Space, Height Equals :45, Trailing to Delete Button

Delete: Trailing Space, Bottom Space, 32:9 Ratio, Height Equals :45, Leading to Reply Btn

like image 958
James Avatar asked Oct 20 '14 17:10

James


2 Answers

With both buttons selected, go to Editor > Pin > Widths Equally. Then set the height, leading/trailing space, space between the buttons, and bottom space.

like image 146
Morgan Chen Avatar answered Sep 18 '22 14:09

Morgan Chen


According to me add following constraints

  • Select Reply button adds leading space and bottom space to superview
  • Add center Y constraints to delete button
  • Then align top and bottom space to delete button and also add trailing space to delete button
  • After this select delete button add bottom space and trailing space.

I had similar operations on one of my view, please see this picture for more infoReply Button

Happy Codding :)

like image 32
iamVishal16 Avatar answered Sep 18 '22 14:09

iamVishal16