• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSWindow's title
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: NSWindow's title
  • Next by Date: Re: Problem with defining an opaque structure
  • Previous by thread: Re: NSWindow's title
  • Next by thread: Re: NSWindow's title
  • Index(es):
    • Date
    • Thread