UILabel可以显示html文本
NSString * htmlString = @"<html><body> Some html string \n <font size=\"13\" color=\"red\">This is some text!</font> </body></html>”;
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
UILabel * myLabel = [[UILabel alloc] initWithFrame:self.view.bounds];
myLabel.attributedText = attrStr;
[self.view addSubview:myLabel];
UILabel可以显示html文本的更多相关文章
- iOS开发小技巧--即时通讯项目:使用富文本在UILabel中显示图片和文字;使用富文本占位显示图片
Label借助富文本显示图片 1.即时通讯项目中语音消息UI的实现,样式如图: 借助富文本在UILabel中显示图片和文字 // 1.创建一个可变的富文本 NSMutableAttributedStr ...
- 使用UIWebView中html标签显示富文本
使用UIWebView中html标签显示富文本 用UIWebView来渲染文本并期望达到富文本的效果开销很大哦! Work 本人此处直接加载自定义字体"新蒂小丸子体",源码不公开, ...
- delphi Caption 垂直显示标签文本
//垂直显示标签文本 Label1.Caption:='垂'+#13+'直'+#13+'显'+#13+'示';//使用相同的方法,我们也可以制作垂直显示的提示(Hint):button1.Hint:= ...
- white-space norma nowrap强制同一行内显示所有文本文字,让所有文字内容中一排显示不换行
日常我们为了让文字内容在一行内显示完,哪怕宽度不够也不能换行,我们可以使用white-space样式,但如果遇到了html br强制换行标签,无论是设置white-space与否都会被<br&g ...
- 通过CSS显示垂直文本
原文链接: CSS Vertical Text 原文日期: 2014年03月18日 翻译日期: 2014年3月22日 翻译人员: 铁锚 示例地址: http://davidwalsh.name/dem ...
- UILabel混合显示动画效果
UILabel混合显示动画效果 效果 源码 https://github.com/YouXianMing/Animations // // MixedColorProgressViewControll ...
- [翻译] LazyFadeInView 渐入显示text文本
LazyFadeInView 渐入显示text文本 https://github.com/itouch2/LazyFadeInView LazyFadeInView is a cool way to ...
- 我的Android进阶之旅------> Android为TextView组件中显示的文本添加背景色
通过上一篇文章 我的Android进阶之旅------> Android在TextView中显示图片方法 (地址:http://blog.csdn.net/ouyang_peng/article ...
- 我的Android进阶之旅------> Android为TextView组件中显示的文本加入背景色
通过上一篇文章 我的Android进阶之旅------> Android在TextView中显示图片方法 (地址:http://blog.csdn.net/ouyang_peng/article ...
随机推荐
- Android adb 命令图解
做了这么长时间的开发与管理,在命令上总是自见则过,往往却忽视了在其命令上的分享过程,所以现在稍微有点时间就把 其命令的相关操作来简单的扫盲一番吧,也系统通过这种方式去授之以渔而不是鱼,好了,我以图解的 ...
- jQuery常用方法集锦
用方法:http://www.cnblogs.com/linzheng/archive/2010/11/14/1877092.html 数组汇总:http://www.cnblogs.com/Andy ...
- java 写文件解析
import java.io.File; import java.io.FileOutputStream; import java.io.*; public class FileTest { publ ...
- ftpclient卡死问题
ftpclient在调用retrieveFileStream(String remote)之后,返回inputstream,如果不想关闭ftp,继续读取其他文件. 一定要先关闭inputstream, ...
- python自定义排序函数
Python内置的 sorted()函数可对list进行排序: >>>sorted([36, 5, 12, 9, 21]) [5, 9, 12, 21, 36] 但 sorted() ...
- JBoss Jopr
http://rhq.jboss.org/ https://issues.jboss.org/browse/JBPAPP6-947 挺好的网站: http://outofmemory.cn/code- ...
- HDU 2152 Fruit
系数为1的母函数…… #include <cstdio> #include <cstring> using namespace std; int n,m,size[105][2 ...
- HDU 1001 Sum Problem
/* 注意可以是负整数,而且在过程中会超过int,所以要用longlong */ #include <cstdio> int main() { long long n; while (sc ...
- UIMenuController在label中的使用
要想在label中使用 必须是继承于label的分类 //// MYlabel.m// MenuController//// Created by 张明 on 16/3/8.// Copyri ...
- Android中库项目、jar包等的使用方法
在软件开发过程中,程序代码的复用,是非常重要的概念.我们总是需要使用一些现有的模块.包.框架,或开发自己的模块.包.框架,来实现对程序代码的复用.比如在JavaWeb编程过程中,经常使用的Struts ...