NSMutableAttributedString常用代码
NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
attachment.image = [UIImage imageNamed:@"mine_chat_popview_jinyan_icon"];
attachment.bounds = CGRectMake(0, -5, 21, 21);
NSMutableAttributedString *attributed = [[NSMutableAttributedString alloc] initWithAttributedString:[NSAttributedString attributedStringWithAttachment:attachment]];
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"禁言"];
[str addAttribute:NSForegroundColorAttributeName value:MAKECOLOR(28, 210, 133) range:NSMakeRange(0,2)];
[attributed appendAttributedString:str];
[self.jinyanBtn setAttributedTitle:attributed forState:UIControlStateNormal];
NSMutableAttributedString常用代码的更多相关文章
- GCD 常用代码
GCD 常用代码 体验代码 异步执行任务 - (void)gcdDemo1 { // 1. 全局队列 dispatch_queue_t q = dispatch_get_global_queue(0, ...
- 转--Android实用的代码片段 常用代码总结
这篇文章主要介绍了Android实用的代码片段 常用代码总结,需要的朋友可以参考下 1:查看是否有存储卡插入 复制代码 代码如下: String status=Environment.getE ...
- 刀哥多线程之03GCD 常用代码
GCD 常用代码 体验代码 异步执行任务 - (void)gcdDemo1 { // 1. 全局队列 dispatch_queue_t q = dispatch_get_global_queue(0, ...
- jquery常用代码集锦
1. 如何修改jquery默认编码(例如默认GB2312改成 UTF-8 ) 1 2 3 4 5 $.ajaxSetup({ ajaxSettings : { contentT ...
- Mysql:常用代码
C/S: Client Server B/S: Brower Server Php主要实现B/S .net IIS Jave TomCat LAMP:L Mysql:常用代码 Create table ...
- javascript常用代码大全
http://caibaojian.com/288.html 原文链接 jquery选中radio //如果之前有选中的,则把选中radio取消掉 $("#tj_cat .pro_ca ...
- Android 常用代码大集合 [转]
[Android]调用字符串资源的几种方法 字符串资源的定义 文件路径:res/values/strings.xml 字符串资源定义示例: <?xml version="1.0&q ...
- NSIS常用代码整理
原文 NSIS常用代码整理 这是一些常用的NSIS代码,少轻狂特意整理出来,方便大家随时查看使用.不定期更新哦~~~ 1 ;获取操作系统盘符 2 ReadEnvStr $R0 SYSTEMDRIVE ...
- PHP常用代码大全(新手入门必备)
PHP常用代码大全(新手入门必备),都是一些开发中常用的基础.需要的朋友可以参考下. 1.连接MYSQL数据库代码 <?php $connec=mysql_connect("loc ...
随机推荐
- 改进你的WordPress导航菜单 —— 输出标题描述
在WordPress 3.0中增加了自定义菜单功能,如果你在WordPress后台(外观>菜单)创建一个菜单,你可以在主题中使用wp_nav_menu()函数来显示这些菜单.但是像图中这种带描述 ...
- [Head First设计模式]山西面馆中的设计模式——观察者模式
系列文章 [Head First设计模式]山西面馆中的设计模式——装饰者模式 引言 不知不自觉又将设计模式融入生活了,吃个饭也不得安生,也发现生活中的很多场景,都可以用设计模式来模拟.原来设计模式就在 ...
- [Head First设计模式]身边的设计模式——适配器模式
系列文章 [Head First设计模式]山西面馆中的设计模式——装饰者模式 [Head First设计模式]山西面馆中的设计模式——观察者模式 [Head First设计模式]山西面馆中的设计模式— ...
- .edmx 文件概述(实体框架)
(一) 认识.edmx文件结构 参考资料: .edmx 文件概述(实体框架) Entity Framework 全面教程详解(转) Entity Framework 教程 Entity Framewo ...
- UIScrollView的其他属性
@property(nonatomic) BOOL bounces; 设置UIScrollView是否需要弹簧效果 @property(nonatomic,getter=isScrollEnabled ...
- jquery选择器(总结)
基本选择器 选择器 描述 示例 #id 根据给定的ID匹配一个元素 $("#id") .class 根据制定的class匹配一个元素 $(".class") ...
- 关于当传过来的值转换成string类型报错的问题
有时候直接写 string str=request.param["str"].tostring;会报错,是因为接受到的值可能是空的 这个时候就可以这样写 string _actio ...
- Git 简明教程
其他Git资料: Git Community Book 中文版
- struts2表单批量提交
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%> <% ...
- awk 双引号vs单引号
centos下面, awk '{...}' 和 awk "{...}" 差别是很大的: [ywt@YuWentao]$ echo "a b c d 1 2 3 4&quo ...