Re: NSWindow's title
Re: NSWindow's title
On Mon, Aug 19, 2002 at 05:27:42PM +0200, Nico wrote:
>
Hi :>
>
>
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 ?
This is what I do, because, at least in 10.1, the default Cocoa
document names violate Apple's own UI guidelines.
- (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName {
// only override window titles not associated with a file
if ([[[self document] fileName] length] == 0) {
// "Untitled" >> "untitled" (otherwise violates Aqua HIG!)
displayName = [displayName lowercaseString];
if ([displayName rangeOfString: @" "].length == 0)
// "untitled" >> "untitled connection"
displayName = [displayName stringByAppendingString: @"
connection"];
else
// "untitled 2" >> "untitled connection 2"
displayName = [displayName
stringByReplacingOccurrencesOfString: @" " withString: @"
connection "];
}
return displayName;
}
--
=Nicholas Riley <email@hidden> | <
http://www.uiuc.edu/ph/www/njriley>
Pablo Research Group, Department of Computer Science and
Medical Scholars Program, University of Illinois at Urbana-Champaign
_______________________________________________
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.