Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable NSDocument's window title popup

I have an NSDocument based app with autosave enabled.

I'd like to prevent this popup from showing: autosave popup

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?

like image 208
pfandrade Avatar asked May 06 '14 12:05

pfandrade


3 Answers

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

like image 192
pfandrade Avatar answered Nov 15 '22 06:11

pfandrade


Return false from NSDocument's autosavesInPlace() override

like image 24
Shoore Avatar answered Nov 15 '22 08:11

Shoore


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)

like image 1
Cue Avatar answered Nov 15 '22 06:11

Cue