Re: Font menu in an NSPopUpButton
Re: Font menu in an NSPopUpButton
- Subject: Re: Font menu in an NSPopUpButton
- From: Dustin Voss <email@hidden>
- Date: Thu, 16 Oct 2003 16:54:28 -0700
On Thursday, October 16, 2003, at 02:41 PM, Darrin Cardani wrote:
I want an NSPopUpButton that contains a list of fonts. I see that
Interface Builder supplies a menu for fonts that you can put into your
menubar menus, but I don't see a way to create a popup button with
fonts in it. What's the recommended way to do that?
Programmatically. Here's how I do it in one of my apps:
// Populate font pop-up.
fontList = [[NSMutableArray alloc] initWithArray:[[NSFontManager
sharedFontManager] availableFontFamilies]];
[fontList sortUsingSelector:@selector(caseInsensitiveCompare:)];
[fontListPopup removeAllItems];
[fontListPopup addItemsWithTitles: fontList];
[fontList release];
It's simple enough.
_______________________________________________
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.