Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我将字体家族列表设置为NSPopupButton. 我不知道如何将选定的字体预览设置为NSTextView 已经尝试过这样
NSPopupButton
NSTextView
NSString *fontstyle = [popup_button titleOfSelectedItem]; NSFont *fontst = [NSFontManager:nil willIncludeFont:fontstyle]; [text_view setFont:fontstyle];
终于我明白了...
NSString *fontstyle = [popup_button titleOfSelectedItem]; NSString *fontsize = [pop_size titleOfSelectedItem]; CGFloat fntsize = [fontsize floatValue]; NSFont *regular = [NSFont fontWithName:fontstyle size:fntsize]; [text_view setFont:regular];