2

In the Mac Developer Reference for windowTitleForDocumentDisplayName, here, it suggests that a window controller can override this method,

to customize the window title. For example, a CAD application could append β€œ-Top” or β€œ-Side,” depending on the view displayed by the window.

But I can't find any example code showing exactly how to do this. When I override this method in my custom window controller class, it doesn't seem to get called, when I create a new instance of my window controller class. I've been searching the web for a couple of days to find information about this method, but there is hardly any info out there. Much of it is really old - my other question is one of the only recent pages linked to by Google.

Help please!

Community
  • 1
  • 1
Bob Broadley
  • 171
  • 1
  • 6
  • 19

2 Answers2

0

This method appears to be called only when the NSWindowController's document is actually set to an NSDocument instance.

Daniel Trebbien
  • 38,421
  • 18
  • 121
  • 193
0

in your NSWindowController subclass:

- (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName
{
    NSString *newName = [NSString stringWithFormat:@"%@ Test", displayName];

    return newName;
}

NOTE: this is called from NSDocumentController's openUntitledDocumentAndDisplay: method, so the input displayName will be some variant of "Untitled".

Ron Reuter
  • 1,287
  • 1
  • 8
  • 14