如何查找与 nsview 相关的所有 CALayers?
我在 Mac OSX 10.7 Lion 中托管 Apple 的 Pitch Shift Audio Unit 插件。 itchShiftView 由 CALayer 组成:每个旋钮一个,等等。
当使用我认为是 CALayer 的旋钮更改参数值时,会出现一些值条,但它们不会显示在 CALayer 层次结构中。当它们应该消失时,它们仍保留在屏幕上,最终导致我的应用程序因退出访问错误而崩溃。
我如何获得对这些层的访问权限,或者为什么它们不与层层次结构的其余部分绑定?
I'm hosting Apple's Pitch Shift Audio Unit plugin in Mac OSX 10.7 Lion. The pitchShiftView is made up of CALayers: one for each knob etc.
There are value bars that appear when changing parameter values with the knobs that I believe are CALayers, but they do not show up in the CALayer hierarchy. They stay on screen when they should disappear, and end up crashing my app with exit bad access.
How do I gain access to these layers, or why arn't they tied to the rest of the layer hierarchy?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们实际上可能不是图层,或者至少不是当前 NSView 中的图层。它们可能是 NSView 的子视图,或者甚至可能是悬停在相关 NSView 之上的 NSView。几乎一切皆有可能。
您需要的第一个工具是 Accessibility Inspector(位于 /Developer 中)。它允许您指向屏幕上的任何内容并找出它在可访问性层次结构中的位置,这通常与它在视图层次结构中的位置密切相关。一旦您了解它们在视图层次结构中的位置,您就可以开始使用调试器进行挖掘,尝试了解它们在层层次结构中的位置(如果它们位于层层次结构中)。请记住,在 Mac 上,
CALayer
是NSView
的可选补充。所以可能没有层次。They may not actually be layers, or at least not layers in the current
NSView
. They might be subviews of the NSView, or they might even be NSViews that hover over top of the NSView in question. Almost anything is possible.The first tool you want is Accessibility Inspector (in /Developer). It lets you point at anything on the screen and find out where it is in the accessibility hierarchy, which very often is closely related to where it is in the view hierarchy. Once you understand where they are in the view hierarchy, you can start digging around with the debugger trying to understand where they are in the layer hierarchy, if they're in the layer hierarchy. Remember that on Mac,
CALayer
is an optional addition toNSView
. So there might not be layers.