user718408
user718408

Reputation: 101

NSButton use setFont not working

Please help me. I want to change font size for the text of NSButton.

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

But it didn't work.

I have another question. How to rotate a NSButton?

Thanks

Upvotes: 0

Views: 1884

Answers (2)

Anne
Anne

Reputation: 27073

Button Font

Your line contains a syntax error, one pair of brackets should be removed.
The following line works correctly:

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

Make sure the IBOutlet is connected properly to the NSButton.

Rotate Button

You can simply create an .png image with the vertical button title.
Use 13px Lucida Grande to make it look native.

enter image description here

Next add the image to a Bevel Button.
The final result looks pretty good.
enter image description here

Upvotes: 1

Manlio
Manlio

Reputation: 10865

To rotate the button you may call

    [button setFrameRotation:90];

That will rotate the button 90° anticlockwise.

Upvotes: 2

Related Questions