xcode 视图正在剪辑其内容错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20353708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 04:22:39  来源:igfitidea点击:

View is Clipping its Content error

xcodemacosinterface-builder

提问by Arc676

I'm using Xcode 4.6. In a window I keep getting this "view is clipping its content" error and when I click on it, the XIB editor highlights a label. What is this error trying to tell me and how to I fix it?

我正在使用 Xcode 4.6。在一个窗口中,我不断收到此“视图正在剪辑其内容”错误,当我单击它时,XIB 编辑器会突出显示一个标签。这个错误试图告诉我什么以及如何修复它?

回答by kirkgcm

First, clicking on the text "View is clipping..." will select the control that has the issue. it happens when you resize a text field too small for the inner text field cell to fit in. enlarging the control makes warning disappear. you can also select the inner cell and go to size inspector to see if there are options to make it smaller to match your desired overall size.

首先,单击文本“View is clipping...”将选择有问题的控件。当您将文本字段调整为太小以至于内部文本字段单元格无法容纳时,就会发生这种情况。放大控件会使警告消失。您还可以选择内部单元格并转到尺寸检查器以查看是否有选项可以使其更小以匹配您所需的整体尺寸。

回答by Brad Werth

You have a carriage return / newline at the end of the text in your label. That empty line is part of the "content" which is larger than the "view". Get rid of your extra newline and you'll take care of this.

您在标签中的文本末尾有一个回车/换行符。该空行是大于“视图”的“内容”的一部分。摆脱你额外的换行符,你会处理这个问题。

回答by Mikael

It's telling you that your constraints hasn't been set up correctly. You can resolve the by clicking on the view in question, then clicking on the small icon at the bottom and choose: "Reset to suggested constraints"

它告诉您您的约束设置不正确。您可以通过单击有问题的视图,然后单击底部的小图标并选择:“重置为建议的约束”来解决此问题

enter image description here

在此处输入图片说明

Or you could click on the little small orange (or red) arrow in your Document Outline (the list to the left of your view that shows all views), then click on Resolve Issue

或者您可以单击文档大纲中的小橙色(或红色)小箭头(显示所有视图的视图左侧的列表),然后单击解决问题