[英]Constraint to add more space between two UIViews
I'm developing an iPhone application with XCode 4.5.2 and latest SDK. 我正在使用XCode 4.5.2和最新的SDK开发iPhone应用程序。
Now I'm using Autolayout to work with one storyboard and use it with iPhone 4S and iPhone 5. 现在,我正在使用“自动布局”来处理一个情节提要板,并将其与iPhone 4S和iPhone 5一起使用。
This is how can you see it with Retina 3.5 form factor: 这是您如何使用Retina 3.5外形尺寸看到的:
And this is how you can see it with Retina 4 form factor: 这就是使用Retina 4外形尺寸时所看到的方式:
I need to add more space between Todos los establecimientos and Todos los products . 我需要在Todos los establecimientos和Todos los产品之间添加更多空间。 And also, between Todos los products and Por distancia > . 而且,在Todos los产品和Por distancia>之间 。
Todos los establecimientos and Todos los products now have a Top Space to: Superview
constraint. Todos los establecimientos和Todos los产品现在具有“ Top Space to: Superview
超级视图”约束。
How can I do to add more space between those elements when I use Retina 4 form factor? 使用Retina 4外形尺寸时,如何在这些元素之间添加更多空间?
This can be done via a constraint with less than 1.0 Priority. 这可以通过优先级小于1.0的约束来完成。 To create a constraint between 2 views select both and click on the constraint button in the lower right corner of the interface builder to select the constraint you need in this case vertical spacing.. 要在2个视图之间创建约束,请同时选择这两个视图,然后单击界面生成器右下角的约束按钮以选择在这种情况下垂直间距所需的约束。
Raywenderlich has a good tutorial on this: Part 1 Part 2 Raywenderlich对此有一个很好的教程: 第1 部分第2部分
Or read Apples documentation: Apple Guide - Understanding Constraints 或阅读Apple文档: Apple指南-了解约束
If you want the "Busqueda por filters" label and the "Por valoracion" labels to maintain their fixed distances to the top and bottom (respectively), then you could embed "Todos los establecimientos", "Todos los products", and "Por distancia" in a view. 如果希望“ Busqueda por过滤器”标签和“ Por valoracion”标签分别保持与顶部和底部的固定距离,则可以嵌入“ Todos los establecimientos”,“ Todos los产品”和“ Por观点”。 Those three items will have fixed spaces to the top, middle and bottom of that view. 这三个项目在该视图的顶部,中间和底部将具有固定的空间。 Give that view vertical spacing constraints to the "Busqueda por filters" label above, and "Por valoracion" label below, and remove any spacing constraints to the top or bottom of the main view. 将该视图的垂直间距约束赋予上方的“ Busqueda por过滤器”标签,并赋予其下方的“ Por valoracion”标签,并删除主视图顶部或底部的任何间距约束。 When the screen size gets bigger, this view will stretch giving more space between its views. 当屏幕尺寸变大时,此视图将拉伸,从而在其视图之间留出更多空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.