第三十三篇、富文本 NSMutableAttributedString
// 设置颜色等
NSMutableDictionary *arrDic = [NSMutableDictionary dictionary];
arrDic[NSForegroundColorAttributeName] = [UIColor purpleColor];
arrDic[NSBackgroundColorAttributeName] = [UIColor greenColor];
arrDic[NSKernAttributeName] = @;
arrDic[NSUnderlineStyleAttributeName] = @; NSMutableAttributedString *attriOneStr = [[NSMutableAttributedString alloc]initWithString:@"来呀,快活呀,反正有大把时光" attributes:arrDic];
self.oneLabel.attributedText = attriOneStr; // 简单的图文混排
NSMutableAttributedString *arrTwoStr = [[NSMutableAttributedString alloc]init];
NSMutableAttributedString *TwoChildStr = [[NSMutableAttributedString alloc]initWithString:@"你好啊"];
[arrTwoStr appendAttributedString:TwoChildStr]; NSTextAttachment *attachMent = [[NSTextAttachment alloc]init];
attachMent.image = [UIImage imageNamed:@""];
attachMent.bounds = CGRectMake(, -, , );
NSAttributedString *picStr = [NSAttributedString attributedStringWithAttachment:attachMent];
[arrTwoStr appendAttributedString:picStr]; NSAttributedString *TwooStr = [[NSAttributedString alloc]initWithString:@"我是小菜鸟"];
[arrTwoStr appendAttributedString:TwooStr];
self.twoLabel.attributedText = arrTwoStr;
第三十三篇、富文本 NSMutableAttributedString的更多相关文章
- iOS计算富文本(NSMutableAttributedString)高度
有时候开发中我们为了样式好看, 需要对文本设置富文本属性, 设置完后那么怎样计算其高度呢, 很简单, 方法如下: - (NSInteger)hideLabelLayoutHeight:(NSStrin ...
- Android UI开发第三十三篇——Navigation Drawer For Android API 7
Creating a Navigation Drawer中使用的Navigation Drawer的android:minSdkVersion="14",现在Android API ...
- 第三十三篇-TabLayout的使用
效果图: 最上方是一个TabLayout,有三个部分,新闻.财经.娱乐,下方是一个ViewPaper,里面包含三个fragment,分别对应三个xml和java class. 第一个Fragment里 ...
- C++第三十三篇 -- 研究一下Windows驱动开发(一)内部构造介绍
因为工作原因,需要做一些与网卡有关的测试,其中涉及到了驱动这一块的知识,虽然程序可以运行,但是不搞清楚,心里总是不安,觉得没理解清楚.因此想看一下驱动开发.查了很多资料,看到有人推荐Windows驱动 ...
- 第三十三篇:使用uiresImporter生成uires.idx及skin.xml
在SOUI中,使用uires.idx这个文件来记录程序中使用的所有资源文件. 此外绘制对象(ISkinObj)则一般放在skin.xml中描述. 要向一个界面中增加一个新的图片,在没有uiresImp ...
- Python之路(第三十三篇) 网络编程:socketserver深度解析
一.socketserver 模块介绍 socketserver是标准库中的一个高级模块,用于网络客户端与服务器的实现.(version = "0.4") 在python2中写作S ...
- 第三十三篇 Python中关于OOP(面向对象)的常用术语
面向对象的优点 从编程进化论可知,面向对象是一种更高等级的结构化编程方式,它的好处主要有两点: 1. 通过封装明确了内外,你做为类的缔造者,你就是女娲,女娲造物的逻辑别人无需知道,女娲想让你知道,你才 ...
- 第三十三篇 玩转数据结构——红黑树(Read Black Tree)
1.. 图解2-3树维持绝对平衡的原理: 2.. 红黑树与2-3树是等价的 3.. 红黑树的特点 简要概括如下: 所有节点非黑即红:根节点为黑:NULL节点为黑:红节点孩子为黑:黑平衡 4.. 实现红 ...
- 第三十三篇:关于ES6,JSON和Webpack
好家伙 1.什么是ES6? ECMAScript是javascript标准 ES6就是ECMAScript的第6个版本 (大概是一个语法标准规范) 2.什么是JSON? JSON 是什么,在数据交换中 ...
随机推荐
- PC/UVa 题号: 110104/706 LC-Display (液晶显示屏)题解
#include <string> #include <iostream> #include <cstring> #include <algorithm> ...
- PS-常用操作
快捷键 设置图片的大小:ctrl+t 放大缩小:ctrl+空格+“+or-”
- Codeforces Beta Round #85 (Div. 1 Only) A. Petya and Inequiations 贪心
A. Petya and Inequiations Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest ...
- Codeforces Round #330 (Div. 2) B. Pasha and Phone 容斥定理
B. Pasha and Phone Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/595/pr ...
- Codeforces Round #318 [RussianCodeCup Thanks-Round] (Div. 1) A. Bear and Poker 分解
A. Bear and Poker Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/573/pro ...
- PACPerformance
https://github.com/kickfjq/android_packages_apps_PACPerformance
- QProcess调用外部程序方式的差异
众所周知QProcess类的作用是启动一个外部的程序并与之交互它有三种方式调用外部程序: 1. execute 2. start 3. startDetached 从调用上看: execute是阻塞调 ...
- 赵雅智_Fragment生命周期
官网帮助文档链接: http://developer.android.com/guide/components/fragments.html 主要看两张图.和跑代码 一,Fragment的生命周 w ...
- 解决easyui-datagrid在ie中无法reload问题
easyui在页面载入时,会自己主动填充datagrid中的数据,当加入.改动.删除后,会触发reload事件,对datagrid进行又一次载入. 这个过程在FireFox中没有问题,用firebug ...
- 关于null和undefined
null和undefined都是一种类型..typeof查看变量类型.不要为该函数迷惑..因为他只是看上去官方! 见http://www.cnblogs.com/zhepama/articles/30 ...