Cocoa renaming MyDocument window title
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"];
}
Override displayName
and return the value you want displayed.
- (NSString *)displayName {
return @"Document 1";
}
If you're subclassing NSWindowController
then override windowTitleForDocumentDisplayName:
instead.
精彩评论