0

I have a NSDocument that I am calling:

[self.windowForSheet setTitleWithRepresentedFilename: @"hello"];

On, but the windows title does not change. It displays MyApp -- Untitled 1. I have also tried:

[self.windowForSheet setTitleWithRepresentedFilename: @"hello"];
[self.windowForSheet display];

But still it does not get updated.

I have confirmed that self.windowForSheet is not nil. Am I doing this incorrectly? Note that I am expecting the 'Untitled 1' part of the title to change.

Kyle
  • 17,317
  • 32
  • 140
  • 246

1 Answers1

1

setTitleWithRepresentedFilename uses a filePath, not an arbitrary text string; I think you are probably looking for title perhaps.

If @"hello" is not an actual path of a file, then using it with setTitleWithRepresentedFilename is likely not going to return the name of the file, which in turn won't change the title of the window.

l'L'l
  • 44,951
  • 10
  • 95
  • 146