lms*_*lms 5 macos cocoa core-graphics quartz-graphics
z-ordering 如何与 Cocoa 中的兄弟 NSViews 一起工作?我很困惑,因为我在 Apple 的文档和 API 中发现了相互矛盾的信息来源。(注意:子视图显然是在其父视图之上呈现的,我在这里明确地谈论兄弟视图)。
假设A:“是的,你可以定义兄弟的z-order NSViews”
IB你可以把对方的俯视图,他们将永远在你所希望的方式进行合成。Editor名为“Send to Back”、“Send Forward”等菜单下的按钮。NSView也有一个命名的方法- (void)addSubview:(NSView *)aView positioned:(NSWindowOrderingMode)place relativeTo:(NSView *)otherView;,这似乎暗示,有一个明确的排序。假设 B:“不可能,兄弟的 z-orderNSViews在运行时是未定义的。有时有效,有时无效。不要相信它!”
For performance reasons, Cocoa does not enforce clipping among sibling views or guarantee correct invalidation and drawing behavior when sibling views overlap. If you want a view to be drawn in front of another view, you should make the front view a subview (or descendant) of the rear view.那么是哪一个呢?
| 归档时间: |
|
| 查看次数: |
4794 次 |
| 最近记录: |