How to disable NSDocument's window title popup
Asked Answered
D

3

8

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?

Dermatogen answered 6/5, 2014 at 12:14 Comment(0)
D
11

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

Dermatogen answered 6/5, 2014 at 16:56 Comment(3)
You need to override that in NSWindow subclass, not in NSWindowController subclass! Dont make the same mistake as I did (:Rhee
This also disable x, minimize, enlarge buttons right? My app just got rejected because of this.Rhee
You should return nil only for NSWindowDocumentVersionsButton. If you return nil for every button, no button will be displayed.Dermatogen
H
4

Return false from NSDocument's autosavesInPlace() override

Halfmast answered 9/11, 2016 at 8:28 Comment(1)
The first line of the question mentions that autosave is enabled. Disabling a feature to avoid showing the button is not a correct answer.Dermatogen
S
1

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)

Sulphate answered 26/6, 2017 at 19:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.