WatchOS系统开发大全(6)-WKInterfaceLabel
生活随笔
收集整理的這篇文章主要介紹了
WatchOS系统开发大全(6)-WKInterfaceLabel
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
WKInterfaceLabel
1.1-簡(jiǎn)介
- WKInterfaceLabel與iOS的UIKit框架中UILabel一樣,是一個(gè)顯示文本的控件。
1.2-API介紹
- WKInterfaceLabel的API比UILabel要簡(jiǎn)單的多。
1.3-使用示例
/* 設(shè)置文本 */topLabel.setText("heima")/* 設(shè)置文本顏色 */bottomLabel.setTextColor(UIColor.greenColor())/* 設(shè)置富文本 *///先初始化一個(gè)AttributedStringlet attribute = NSMutableAttributedString(string: "itcast")//添加屬性attribute.addAttributes([NSFontAttributeName:UIFont.systemFontOfSize(20),NSForegroundColorAttributeName:UIColor.redColor()], range: NSMakeRange(0, 2))bottomLabel.setAttributedText(attribute)- 效果?
總結(jié)
以上是生活随笔為你收集整理的WatchOS系统开发大全(6)-WKInterfaceLabel的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: WatchOS系统开发大全(5)-WKI
- 下一篇: WatchOS系统开发大全(7)-WKI