简体   繁体   English

Swift:更改NSbutton的字体和样式

[英]Swift: change font and styling of a NSbutton

how do I change via code in swift for mac osx , the NSbutton title font type and font size after editing the font color? 在编辑字体颜色后,如何通过swift for mac osx中的代码更改NSbutton标题字体类型和字体大小? Via the Xcode gui editor is not possible to update the font when I change the title color. 当我更改标题颜色时,无法通过Xcode gui编辑器更新字体。

Is this what you are looking for? 这是你想要的?

button.title = "Test" button.title =“测试”

button.font = NSFont(name: "Century Gothic Bold", size: 26) button.font = NSFont(名称:“世纪哥特式粗体”,尺寸:26)

This will change the title, font type and size of the NSButton. 这将更改标题,字体类型和NSButton的大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM