Diego Rodrigues
Diego Rodrigues

Reputation: 73

Auto-Layout Xcode 6

I'm having some problems with Auto-Layout in Xcode 6 Beta, I have a ViewController and two buttons, and want them to occupy the entire area of view, each occupying half of it.

How I can do that? Whats constrains and ruler I have to apply?

screenshot

Thanks

Upvotes: 0

Views: 127

Answers (2)

Do2
Do2

Reputation: 1791

For each one of the set Equal Heights constraint to the view(set the multiplier to 0.5). For the first button set top right, left constraint to 0. For the second button set bottom right, left constraint to 0.

Upvotes: 0

Sander Saelmans
Sander Saelmans

Reputation: 861

Select both buttons, open the constraints tab and set all the "Spacing to nearest neighbour" constraints to 0. This ensures that the 2 buttons will always fill the whole super view. By checking the Equal Heights option we ensure that both buttons get the same size, which will result in 2 50/50 height and 100% width filling buttons.

https://www.dropbox.com/s/k4fnmqqblpc35st/Screenshot%202014-09-08%2002.59.22.png?dl=0

Upvotes: 1

Related Questions