使NSButton打开字体面板

问题描述:

我想知道如何在Mac OS X中打开一个按钮打开字体面板使用Cocoa,我有一个NSTextView在我的应用程序,并希望字体对话框显示时,当用户单击按钮。提前感谢!

I was wondering how to go about making a button open up the fonts panel in Mac OS X using Cocoa, I have an NSTextView in my application and want the fonts dialogue to display when the user clicks the button. Thanks in advance!

默认情况下出现的最后一个对象(你在编辑区域左边看到的对象)是字体管理器。您所要做的就是控制从按钮到字体管理器的拖动,并连接 orderFrontFontPanel:操作。

The last object that comes by default (those one that you see in the left from the editing area) is exactly the Font Manager. All you have to do is to control drag from your button to the font manager and connect the orderFrontFontPanel: action.