2011-05-30 32 views
0

請幫幫我。我想改變NSButton文本的字體大小。NSButton使用setFont不起作用

[myButon setFont:[[NSFont fontWithName:@"Arial" size:20]]]; 

但它沒有奏效。

我還有一個問題。 如何旋轉NSButton?

感謝

回答

1

按鈕字體

你行包含一個語法錯誤,一對括號應予刪除。
以下行正常工作:

[theButton setFont:[NSFont fontWithName:@"Arial" size:20]]; 

確保IBOutlet正確連接到NSButton

旋轉鍵

你可以簡單地與垂直按鈕標題創建的PNG圖片。
使用13px Lucida Grande使其看起來很原生。

enter image description here

接下來的圖像添加到斜角按鈕。
最終結果看起來不錯。
enter image description here

2

要旋轉按鈕,您可以撥打

[button setFrameRotation:90]; 

這將旋轉按鈕90°反轉。

+0

哇,這對我來說是新的:) – Anne 2011-05-30 14:59:51

+0

感謝您的回覆。 – user718408 2011-06-05 07:45:36

+0

此方法有以下問題。 http://stackoverflow.com/questions/7278852/animated-rotation-of-nsview-contents – 2012-01-02 12:10:30