简体   繁体   中英

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?

截图

Thanks

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM