WKInterfaceLabel
1.1-简介
- WKInterfaceLabel与iOS的UIKit框架中UILabel一样,是一个显示文本的控件。
1.2-API介绍
- WKInterfaceLabel的API比UILabel要简单的多。
public func setText(text: String?)
public func setTextColor(color: UIColor?)
public func setAttributedText(attributedText: NSAttributedString?)
1.3-使用示例
topLabel.setText("heima")
bottomLabel.setTextColor(UIColor.greenColor())
let attribute = NSMutableAttributedString(string: "itcast")
attribute.addAttributes([NSFontAttributeName:UIFont.systemFontOfSize(20),NSForegroundColorAttributeName:UIColor.redColor()], range: NSMakeRange(0, 2))
bottomLabel.setAttributedText(attribute)