简体   繁体   English

使用Mac os Lion的自动布局功能时出现问题

[英]Problem using autolayout feature of Mac os Lion

I am using autolayout feature for my mac app.I have enabled autolayout for my mainWindow & also for its child views.But on expanding window , only my window expands in size but not the child views.And on app launch I get following message in the console 我正在为我的mac应用程序使用autolayout功能。我已经为我的mainWindow启用了autolayout以及它的子视图。但是在扩展窗口上,只有我的窗口扩大了大小而不是子视图。在应用程序启动时,我得到以下消息控制台

"Layout still needs update after calling -[WebHTMLView layout]. WebHTMLView or one of its superclasses may have overridden -layout without calling super. Or, something may have dirtied layout in the middle of updating it. Both are programming errors in Cocoa Autolayout. The former is pretty likely to arise if some pre-Cocoa Autolayout class had a method called layout, but it should be fixed." “在调用之后布局仍然需要更新 - [WebHTMLView布局] .WebHTMLView或其中一个超类可能已经覆盖了--layout而没有调用super。或者,在更新它的过程中可能会出现脏的布局。两者都是Cocoa Autolayout中的编程错误。如果一些pre-Cocoa Autolayout类有一个名为layout的方法,那么前者很可能出现,但它应该被修复。“

Please help! 请帮忙!

The log is probably not related to your issue. 该日志可能与您的问题无关。

For your issue, select a view that you expect to stay pinned to the side of your window but isn't. 对于您的问题,请选择一个您希望固定在窗口侧面但不是固定的视图。 You should see the constraints involving that view drawn as blue. 您应该看到涉及该视图的约束被绘制为蓝色。 It'll stay pinned if and only if you see a constraint there that pins it. 当且仅当你看到一个限制它的时候,它才会保持固定状态。 You can explicitly add constraints with the Editor > Align and Editor > Pin menus. 您可以使用编辑器>对齐和编辑器>固定菜单显式添​​加约束。

The log is because web view implements that method and needs to rev, but it's mostly[1] harmless. 该日志是因为Web视图实现了该方法并需要rev,但它主要是[1]无害的。

[1] Possibly html layout in the web view ends up triggering more often than necessary. [1]可能在Web视图中的html布局最终会触发更多的必要。

Did you check if 你有没有检查过

WebHTMLView or one of its superclasses may have overridden -layout without calling super. WebHTMLView或其中一个超类可能已经重写-layout而不调用super。

like the error text explains? 像错误文字解释? WebHTMLView is your class? WebHTMLView是你的班级?

As they say: 正如他们所说:

The former is pretty likely to arise if some pre-Cocoa Autolayout class had a method called layout, but it should be fixed. 如果一些pre-Cocoa Autolayout类有一个名为layout的方法,那么很可能会出现前者,但应该修复它。

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

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