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