xcode 6中的约束和边距,snap后显示空格的边距 [英] Constraints and margins in xcode 6, margins revealing whitespace after snap

查看:386
本文介绍了xcode 6中的约束和边距,snap后显示空格的边距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想限制一个控制器中的几个视图。我了解如何设置视图之间的间距,以及每个视图的宽度/高度。我有点不确定动态高度和宽度,我假设是边际锁定责任适当地调整重量。

I'm trying to constrain a couple of views within a controller. I understand how to set spacing between views, and width/height for each view. I'm a little unsure about dynamic height and width, I'm assuming that it's the margin-locks duty to adjust the weight appropriately. Advice on this would be much appreciated.

无论如何,我试图设置一个Trailing Space to:Superview约束,它自动设置为-16。查看照片:

Anyways, I'm trying to set a "Trailing Space to: Superview" constraint, which automatically sets to -16. See photo:

正如你所看到的,我已经为左右和视图顶部选择了边距。

As you can see, I've selected margins for left right and top of view.

在iPhone 6 Plus中启动应用程序,设置的边距大约需要-20。你可以看到我的问题。这是另一张照片,我所说的视图是绿色的(你可以看到它的两侧的空白):

But once I launch the app in iPhone 6 Plus, the margins set are about -20 required. You can see my problem. Here's another photo, the view I'm talking about is green (you can see the whitespace on either side of it):

推荐答案

边距是左右两边的差距,使事情看起来整洁。由于不同设备的宽度,不同设备具有不同的尺寸余量。如果你想限制你的视图边缘,你需要关闭边距,并将约束设置为0. 6加上的边距是20,我相信其他设备的边距是16。

The margins are a gap on the left and right to make things look neat. Due to the width of different devices, different devices have different sized margins. If you want to constrain your view to the edge you need to turn the margins off and set the constraints to 0. The margin on the 6 plus is 20, and I believe that the margins on the other devices are 16.

如果没有宽度约束,如果您有左右边距,视图将伸展。

If there is no width constraint the view will stretch if you have a left and right margin.

这篇关于xcode 6中的约束和边距,snap后显示空格的边距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆