简体   繁体   English

在界面生成器中创建的按钮……这是什么虚线,如何解决?

[英]Button created in interface builder… what is this dashed line and how do I fix it?

This is a button created with interface builder: 这是使用界面构建器创建的按钮:

在此处输入图片说明

What is this orange dashed line (button text area, right?), why this is outside the button and how do I make it be inside the button (if this is the case)??? 这条橙色虚线是什么(按钮文本区域,对吗?),这是为什么在按钮外部,以及如何使其位于按钮内部(如果是这种情况)???

It's because you have auto layout on and that's what it thinks the size and position should be based on the constraints. 这是因为您已启用自动布局,这就是它认为大小和位置应基于约束的原因。 Sometimes it shows this when the element is moved or resized without adjusting constraints, other times it shows because the constraints given are ambiguous. 有时在不调整约束的情况下移动或调整元素大小时会显示此内容,而有时会因为给定的约束不明确而显示出来。

Google auto layout. Google自动版面配置。 You haven't provided all the required constraints or they aren't the ones you want. 您尚未提供所有必需的约束,或者它们不是您想要的约束。 The red box indicates where your button would be if it follows the provided constraints. 红色框表示如果按钮遵循提供的约束,按钮将位于何处。

One possible fix: in interface builder, you see a few buttons on the bottom right. 一种可能的解决方案:在界面生成器中,您会在右下角看到一些按钮。 click the third one and then select update constraints. 单击第三个,然后选择更新约束。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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