Are layer-backed NSView siblings allowed to overlap?

前端 未结 5 706
有刺的猬
有刺的猬 2020-12-09 05:53

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

Note: For performance reasons, Cocoa does not enforce clipping among sibling views or g

5条回答
  •  温柔的废话
    2020-12-09 06:23

    After some research, it seems that the Apple Documentation is indeed out of date.

    Layer-backed NSView siblings are allowed to overlap since 10.5.

    This discussion from 2009, involving Apple engineers David Duncan and Corbin Dunn finally provides some clear answers:

    Overlapping views work on Leopard, but do not work before that. The documentation is out of date.

    I have a group of views, each one with many smaller views inside, which need to be presented in an overlapping manner over the same rect on a window, so that they can be seen through each other. In my preliminary tests, I made each big view a sibling of a single background view. Was planning on bringing each one to the front, when necessary by re-arranging the z-order. Is there any future (or present) in this appoach?

    That will work on Leopard.

    Source: http://www.cocoabuilder.com/archive/cocoa/228191-nsview-behaves-different-on-10-4-vs-10-5.html#228983

    Update: The James Dempsey also replied on Twitter:

    My understanding is that overlapping sibling views are OK as of 10.5, layer-backed or not.

提交回复
热议问题