Xcode 5 和 Objective-C 中的运行时错误时,剪辑视图的帧会有所不同

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19298900/
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:04:22  来源:igfitidea点击:

Frame for clip view will be different at runtime error in Xcode 5 and Objective-C

objective-cxcodemacoscocoa

提问by Blaszard

I'm now building on OS X app using Xcode 5.0 and Cocoa, and when I used a lot of objects ranging from text field, text view, radio buttons, to check box, etc... and ran the simulator, it looks like working successfully. However, there are two warnings which are tagged with yellow triangles that read Misplaced view - Frame for "clip view" will be different at runtimein MainMenu.xibfile.

我现在正在使用 Xcode 5.0 和 Cocoa 在 OS X 应用程序上构建,当我使用了很多对象,从文本字段、文本视图、单选按钮到复选框等......并运行模拟器时,它看起来像工作成功。但是,有两个警告用黄色三角形标记,Misplaced view - Frame for "clip view" will be different at runtimeMainMenu.xib文件中读取。

What does the error mean? And how can I resolve the warnings? And finally, should I bother to work a bit harder to try to remove those warnings when I get to sell the app? (or does Apple still allow developers to sell an app even when it has some warnings but nonetheless sounds working?)

错误是什么意思?我该如何解决警告?最后,当我开始销售该应用程序时,我是否应该更加努力地尝试删除这些警告?(或者,即使应用程序有一些警告但听起来仍然有效,Apple 是否仍然允许开发人员出售应用程序?)

For your information, I didn't write any code in any of my files yet - just dragged objects out to Interface Builder, and edited and aligned those objects a bit and just ran it, which this bookdoes (but this book assumes to use Xcode 4).

为了您的信息,我还没有在我的任何文件中编写任何代码 - 只是将对象拖出到 Interface Builder,然后稍微编辑和对齐这些对象并运行它,这本书就是这样做的(但本书假设使用Xcode 4)。

Thanks.

谢谢。

回答by Gerd K

Xcode5 defaults to using Auto-Layout. The warnings mean that some of your UI elements do not have enough constraints set, so when you manipulate the UI (for example resize the window) things may look different than you intended.

Xcode5 默认使用自动布局。警告意味着您的某些 UI 元素没有设置足够的约束,因此当您操作 UI(例如调整窗口大小)时,事情可能看起来与您预期的不同。

When you open MainMenu.xibin Interface Builder, a yellow arrow should appear in the component section. Click that arrow and a view appears that explains the offending elements. Each has another yellow element that brings up a context menu with suggested fixes.

当您MainMenu.xib在 Interface Builder 中打开时,组件部分中应该会出现一个黄色箭头。单击该箭头,会出现一个解释违规元素的视图。每个都有另一个黄色元素,可以显示带有建议修复的上下文菜单。

回答by ThE uSeFuL

Optionally you can disable "Use Autolayout" of the nib.

您可以选择禁用笔尖的“使用自动布局”。