Wednesday 15 August 2012

objective c - NSPopupButton with Live Fonts (Styled Text) -


I wonder if it is possible to show live fonts in popup control controls ( NSPopupButton )? Currently, I load a popup plugin with the list of available fonts in the following ways.

  NSArray * familyNames = [[NSFontManager sharedFontManager] availableFontFamilies]; NSMutableArray * fontarray = [[NSMutableArray alloc] initWithObjects: zero]; [Font addobrack: @ "- select one -"]; (NSString * Family name in family) {[fontarray addObject: family]; } [Fontmenu1p addItemsWithTitles: fontarray]; Something like, like the following, using NSMutableAttributedString (for family in the family of NSString * family), for example   

I get a direct error. I do not know that my attitude is correct. I do not even know that the popup button supports the style text.

Thank you for your help.

Even I did not even test it, I think our approach will not work NSPopUpButton has a convenient API for its menu of convenient, but small (usually a pop-up item is not considered to be responsible, there is no separate idea.)

I make an example of each item I try. There is a setter, which lets you set the strings given for credit. After that you have to collect it in an example of a pop-up button.

BTW: [aString setAttributes: attr1 Category: nsmkrange (0, family. Length-1)]; Why -1? The length is the length, the last four is not an indicator and you want to set a boundary, which takes the length, not even the indicator of the previous character.

No comments:

Post a Comment