How to disable NSDocument's window title popup

↘锁芯ラ 提交于 2019-12-06 23:21:31

问题


I have an NSDocument based app with autosave enabled.

I'd like to prevent this popup from showing:

I have tried returning nil from NSWindow's –title, –representedFilename and –representedURL which hide the title effectively hide the title but have no effect on the downward facing disclosure indicator and the popup.

Is there a way I can prevent this popup from being presented?


回答1:


I was able to prevent the button from being shown by overriding NSWindow's

+ (NSButton *)standardWindowButton:(NSWindowButton)windowButtonKind forStyleMask:(NSUInteger)windowStyle

and returning nil for NSWindowDocumentVersionsButton




回答2:


Return false from NSDocument's autosavesInPlace() override




回答3:


You can also use a streamlined toolbar (wwdc2016)

  override func viewWillAppear() {
        super.viewWillAppear()

        self.view.window!.titleVisibility = .hidden  
  }

This removes also the title bar (but not the ones of tabbed windows)



来源:https://stackoverflow.com/questions/23494436/how-to-disable-nsdocuments-window-title-popup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!