是否允许基于layer的NSView兄弟姐妹重叠? [英] Are layer-backed NSView siblings allowed to overlap?

查看:171
本文介绍了是否允许基于layer的NSView兄弟姐妹重叠?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有点困惑。
Apple文档说明:


注意:出于性能原因,Cocoa不强制在
之间剪切视图或保证正确的无效和绘制行为
当兄弟视图重叠时。如果你想在
前面绘制视图,你应该使前视图成为后视图的子视图(或后代)




因此,根据这一点,兄弟视图不应该重叠,否则行为是未定义的。



Cocoa幻灯片演示应用,但是,层支持NSView的兄弟姐妹做重叠,似乎工作正常:





Cocoa Slides示例代码错误,这只是一个巧合作品,还是文档过时了?从10.5版开始,这是?

解决方案

重叠视图在Leopard和更高版本上工作正常, / p>

I'm a little confused. The Apple Documentation states this:

Note: 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.

So according to this, sibling views should not overlap or else the behavior is undefined.

In the Cocoa Slides demo app, however, layer-backed NSView siblings do overlap and it seems to work just fine:

So is the Cocoa Slides sample code wrong and it's just a coincidence that it works, or is the documentation out of date? Out of date since 10.5, that is?

解决方案

Overlapping views work fine, layer backed or not, on Leopard and higher.

这篇关于是否允许基于layer的NSView兄弟姐妹重叠?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆