WatchOS系统开发大全(6)-WKInterfaceLabel
来源:互联网 发布:photoshop cs软件下载 编辑:程序博客网 时间:2024/06/08 13:47
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()) /* 设置富文本 */ //先初始化一个AttributedString let attribute = NSMutableAttributedString(string: "itcast") //添加属性 attribute.addAttributes([NSFontAttributeName:UIFont.systemFontOfSize(20),NSForegroundColorAttributeName:UIColor.redColor()], range: NSMakeRange(0, 2)) bottomLabel.setAttributedText(attribute)
- 效果
阅读全文
0 0
- WatchOS系统开发大全(6)-WKInterfaceLabel
- WatchOS系统开发大全
- WatchOS系统开发大全(7)-WKInterfaceImage
- WatchOS系统开发大全(8)-WKInterfaceGroup
- WatchOS系统开发大全(1)-AppleWatch背景介绍
- WatchOS系统开发大全(2)-WatchApp运行原理
- WatchOS系统开发大全(4)-WatchApp生命周期
- WatchOS系统开发大全(5)-WKInterfaceController的生命周期
- WatchOS系统开发大全(3)-创建第一个WatchApp工程
- watchOS开发——Notification介绍
- watchOS开发——界面对象
- watchOS 2:架构变化和开发注意事项
- iWatch开发:WatchOS 消息推送教程
- watchOS 2
- iOS开发 ☞ 系统通知大全
- 安卓系统开发常用指令大全
- WWDC15 Session笔记 - 30 分钟开发一个简单的 watchOS 2 app
- watchOS开发——配置静态通知界面和动态通知界面
- 乒乓球
- Struts2动态参数封装
- 1090. Highest Price in Supply Chain (25)<BFS,DFS>
- [Leetcode] 319. Bulb Switcher 解题报告
- Android_传感器
- WatchOS系统开发大全(6)-WKInterfaceLabel
- 【剑指offer】面试题32(3):之字形打印二叉树
- 【python】在图片加上数字
- 数组元素标记法
- Python线程同步
- 计算机设计思想 —— 分层模型
- 新闻网页类开发html和iOS原生交互
- Enterprise Architect 数据库逆向工程(导入已经存在的数据表结构)
- XStream读取XML文件