Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa Mac Application Title says: "untitled"

I have created a document based Mac OSX application, and when I'm editing in Interface Builder, the title is correct (I filled out that portion of the inspector) but once the program runs, the application title is 'Untitled'. How can I change it? In my IB Doc Window, I have instances of Files Owner, First Responder, NSApplication, and NSWindow. There is no view controller, is that the issue? I'm new to Cocoa..

like image 705
Zakman411 Avatar asked Jan 18 '11 02:01

Zakman411


1 Answers

One solution is to override -displayName in your NSDocument subclass:

- (NSString *)displayName {
    if (![self fileURL])
        return @"Some custom untitled string";

    return [super displayName];
}

You can also check out NSWindowController's -windowTitleForDocumentDisplayName: if you're using custom window controllers.

like image 51
Wevah Avatar answered Sep 21 '22 00:09

Wevah