【发布时间】:2020-02-19 20:53:05
【问题描述】:
我有一个包含几个子视图(NSButton、NSTextField、NSPopUpButton)的视图和一个带有微调器图标的 NSImageView,当从网络检索数据时,该图标应该显示在其他视图的顶部。
要在我设置的顶部显示 NSImageView
imageViewSpinner.wantsLayer = true
imageViewSpinner.layer?.backgroundColor = NSColor.windowBackgroundColor.cgColor
问题是,焦点边框和 PopUpButtons 仍然可以通过 NSImageView 访问/发光(参见附加视频)。
为了解决这个问题,我可以遍历所有其他子视图并将它们设置为“isHidden”或“disabled”,但我想知道是否有更简洁的解决方案来解决这个问题,例如将 NSImageView 定义为没有东西的最顶层过关了吗?
【问题讨论】:
标签: cocoa show-hide nsimageview topmost