Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我NSToolbar在 Interface Builder 中创建了一个包含一些项目的项目(并设置了它们的可见性优先级)。当我调整窗口大小时,项目会按照预期的优先级被删除,但是会出现一个带有空菜单的溢出按钮。我怎样才能阻止这种情况发生?
NSToolbar
每个NSToolbarItem都有一个menuFormRepresentation属性,可以设置nil为阻止它出现在此菜单中。因此,对工具栏中的所有项目执行此操作以阻止按钮出现:
NSToolbarItem
menuFormRepresentation
nil
toolbar?.items.forEach({ (item) in item.menuFormRepresentation = nil })