属性字符串--在label上设置图片和文字
来源:互联网 发布:简单的编程心形 编辑:程序博客网 时间:2024/05/18 13:26
在label上显示图片利用属性字符串、而不是imageView
let leftTwo = UILabel(frame: CGRectMake(40, 20, 65, 28)) let textAttachment = NSTextAttachment() textAttachment.image = UIImage(named: "imageName") textAttachment.bounds = CGRectMake(0, 0, 14, 10) let attStrtext = NSAttributedString(attachment: textAttachment) let attStr = NSMutableAttributedString(string: title) attStr.addAttribute(NSFontAttributeName, value: (_globaluifontmorebig3old)!, range: NSMakeRange(0, title.length)) attStr.addAttribute(NSForegroundColorAttributeName, value: GLOBAL_MASTER_COLOR, range: NSMakeRange(0, title.length)) attStr.insertAttributedString(attStrtext, atIndex: title.length) leftTwo.attributedText = attStr
0 0
- 属性字符串--在label上设置图片和文字
- 一个带有属性的字符串(比如文字颜色/字体属性等文字属性) 在label上显示需要使用 attributedText 属性
- iOS富文本编辑(在label里显示文字和图片)
- iOS富文本编辑(在label里显示文字和图片)
- CoreText 设置文字属性和插入图片
- 在图片上添加文字和图片
- label指定位置文字属性设置
- 在QListWidgetItem上绘制文字和图片
- iOS - UIButton(UIEdgeInsets)/设置button上的文字和图片 在定义位置
- 28.iOS - UIButton(UIEdgeInsets)/设置button上的文字和图片 在定义位置
- iOS - UIButton(UIEdgeInsets)/设置button上的文字和图片 在定义位置
- iOS中label设置属性字符串
- UIButton设置图片在上 文字在下的方法
- iOS按钮设置图片在上文字在下
- iOS按钮设置图片在上文字在下
- 设置一个Label控件上文字的字体样式和字体大小随机的代码.
- 设置一个Label控件上文字的字体样式和字体大小随机的代码
- 图片滚动和在图片上增加文字显示
- android 输入法弹出键盘把listview顶上去,保留顶部标题栏位置不动
- 何时GC的2种判定与3种GC算法
- 从ADAS到无人驾驶 关键技术有哪些
- 02 Struts2开发环境的搭建和第一个Struts2应用开发
- iOS 如何让UITableView显示时自动滚动到底部(不闪动)
- 属性字符串--在label上设置图片和文字
- block,inline和inline-block概念和区别
- mysql 视图基本操作
- Android Button按钮点击背景和文字变化
- leetcode.187. Repeated DNA Sequences
- 第六章 子过程:
- 写日志文件
- Java内存模型及管理
- CentOS7 编译安装Nginx