Re: NSWindow's title
Re: NSWindow's title
- Subject: Re: NSWindow's title
- From: Mel Walker <email@hidden>
- Date: Mon, 19 Aug 2002 10:47:02 -0600
On Monday, August 19, 2002, at 10:18 AM, Nico <email@hidden> wrote:
I've got a little problem woncerning NSWindows.. In a doc-based Cocoa app,
each time I create a new document, its window set its title to "Untitled
x",
even if I use -setTitle: in my overriden method of
-windowControllerDidLoadNib:
How can I avoid this and choose my own title ?
In my document subclass, I use this:
- (NSString *)displayName
{
if([super fileName] == nil)
{
return [NSString stringWithFormat:@"Untitled %@", [super fileType]];
}
else
{
return [NSString stringWithFormat:@"%@ (%@)", [[[super fileName]
lastPathComponent] stringByDeletingPathExtension], [super fileType]];
}
return [super displayName];
}
This gives me the "Untitled XYZZY-Foobar document" or "MyFile
(XYZZY-Foobar document)" kind of titles. Adjust for your own use.
--
Mel Walker <email@hidden>
Software Engineer
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.