简体   繁体   English

限制在两个UIView之间添加更多空间

[英]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 establecimientosTodos 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 establecimientosTodos 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.

相关问题 在两个视图之间添加尾随约束 - Add trailing constraint between two views 如何在两个UIView之间完成“ 90%的滑动” - How to accomplish a “90% slide” between two UIViews iOS:如何为两个UIView之间的翻转设置动画? - iOS: How to animate a flip between two UIViews? Swift:在另外两个UIView之间拖动UIView - Swift: Drag a UIView between two other UIViews iOS:如何使两个UIViews自动填充空间? - iOS: How do you make two UIViews auto fill space? 是否可以在视图中的两个表之间使用UIViewAnimationTransitionFlipFromRight,而不是两个UIView? - Is it possible to use UIViewAnimationTransitionFlipFromRight between two Tables in a view, instead of two UIViews? 如何在iOS 7中的两个UIView之间滑动/滑动/屏幕边缘滑动 - How to slide / swipe / screen edge swipe between two UIViews in iOS 7 如何通过使用段控件ios在两个UIView之间正确切换? - How to correctly switch between two UIViews by using segment control ios? iOS-使用CATransition在两个UIView之间正确设置动画 - iOS - properly animate between two UIViews using CATransition CALayer性能问题:动画化两个UIView之间锚定的线 - CALayer performance problem: animating a line anchored between two UIViews
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM