内容简介:我想知道如何在swift中将标题颜色更改为NSButton,我在objective-c中看到了很多例子,但我认为在swift中实现是不同的,有人能为我提供一个例子吗?翻译自:https://stackoverflow.com/questions/27875813/swift-mac-osx-nsbutton-title-color
我想知道如何在swift中将标题颜色更改为NSButton,我在objective-c中看到了很多例子,但我认为在swift中实现是不同的,有人能为我提供一个例子吗?
在viewDidLoad或某处尝试此操作.
在Swift 3中:
let pstyle = NSMutableParagraphStyle()
pstyle.alignment = .center
button.attributedTitle = NSAttributedString(string: "Title", attributes: [ NSForegroundColorAttributeName : NSColor.red, NSParagraphStyleAttributeName : pstyle ])
翻译自:https://stackoverflow.com/questions/27875813/swift-mac-osx-nsbutton-title-color
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Spring
Bruce Tate、Justin Gehtland / O'Reilly Media, Inc. / 2005-04-12 / USD 29.95
Since development first began on Spring in 2003, there's been a constant buzz about it in Java development publications and corporate IT departments. The reason is clear: Spring is a lightweight Java......一起来看看 《Spring》 这本书的介绍吧!