Xcode 11添加新的约束设置为零:使用设置值代替默认值/标准 [英] Xcode 11 add new constraints set zero: use set value instead of default / standard

查看:230
本文介绍了Xcode 11添加新的约束设置为零:使用设置值代替默认值/标准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经使用自动布局添加新的约束,以对超级视图/相对视图进行简单的约束,如下所示(持续时间很长):

I used to use autolayout add new constraints to make simple constraints to superview / relative view like this (for loooong time):

但是,最近在更新到最新的xcode(11.3.3或仅11.3/11C29)之后,我遇到了一个奇怪的问题:当我将常量设置为0时,它们总是以不想要的方式生成约束,如下所示:

However, recently after updated to the latest xcode (11.3.3 or just 11.3/11C29), I have this weird issue: when I set the constant = 0, they always generate the constraints in an unwanted way like this:

似乎默认值是20,这使我的观点看起来很错误(与20相比是0?)

And it seems default value is somehow 20 and making my view look so wrong (0 compared to 20?)

如果我通过编辑约束来解决此问题,则:

If I fix that by edit the constraint like this:

然后它将再次校正(图像在编辑约束之后,在编辑之前显示常量= Standard)

Then it'll correct again (the image is after edited the constraints, before edited it display constant = Standard)

我什至不知道如何描述问题,但是如何解决这个新的add new constraint以使用我的期望值而不是标准/默认值?

I don't even know how to describe the issue, but how do I fix this new add new constraint to use my desire point instead of standard / default?

更新:

这似乎仅在约束超级观看时发生.不知道如何解决.

It seems to only happened when constraint to superview. No clue how to fix tho.

2020年4月1日更新:

Update Apr-01-2020:

Xcode11.4修复了此问题.

Xcode11.4 fixed this.

推荐答案

似乎像个bug(别忘了向Apple提交文件).这是一个简单的解决方法:

Seems like a bug (don't forget to file with Apple). Here's a simple workaround:

在弹出框"中填写数字时,请键入0.01,而不要键入0.这样可以防止数字神秘地更改为标准".好的,因此0.010不同,但是它足够接近,您无法分辨出差异,至少您不必回头再稍后对其进行更改.

When you fill in the number in the "popover", instead of typing 0, type 0.01. This will prevent the number from changing mysteriously to "Standard". Okay, so 0.01 is not the same as 0 but it's close enough that you can't tell the difference, and at least you don't have to go back and change it later.

编辑苹果表示该错误将在Xcode 11.4中修复:

EDIT Apple says that this bug will be fixed in Xcode 11.4:

修复了一个错误,该错误导致无法在约束弹出窗口编辑器中输入0常量. (54076090)

Fixed a bug that prevented entering a 0 constant in the constraint popup editors. (54076090)

这篇关于Xcode 11添加新的约束设置为零:使用设置值代替默认值/标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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