views:

20

answers:

1

How can I change the title of a window in a document based cocoa application? I get an error when I try the following code in MyDocument.m

- (void)awakeFromNib
{
    [self setTitle:@"Document 1"];
}
+1  A: 

Override displayName and return the value you want displayed.

- (NSString *)displayName {
    return @"Document 1";
}

If you're subclassing NSWindowController then override windowTitleForDocumentDisplayName: instead.

Alex