NSAttributeString创建各种文字效果
- NSDictionary *attributes =@{
- NSForegroundColorAttributeName: [UIColorredColor],
- NSFontAttributeName: [UIFontfontWithName:@"Zapfino" size:16.0]
- };
- NSString *strDisplayText =@"This is an attributed string.";
- NSAttributedString *attributedText = [[NSAttributedStringalloc] initWithString:strDisplayTextattributes:attributes];
- self.lblInfo.attributedText= attributedText;
- NSDictionary *attributes1 =@{
- NSBackgroundColorAttributeName: [UIColororangeColor],
- NSFontAttributeName: [UIFontfontWithName:@"Zapfino" size:22.0],
- NSKernAttributeName: @-1.0
- };
- NSString *strDisplayText1 =@"Orange Background";
- NSAttributedString *attributedText1 = [[NSAttributedStringalloc] initWithString:strDisplayText1attributes:attributes1];
- self.lblInfo1.attributedText= attributedText1;
- NSShadow*shadow = [[NSShadow alloc]init];
- shadow.shadowColor = [UIColorgreenColor];
- shadow.shadowBlurRadius = 5.0;
- shadow.shadowOffset = CGSizeMake(1.0,1.0);
- NSDictionary *attributes2 =@{
- NSUnderlineStyleAttributeName:@1,
- NSShadowAttributeName: shadow
- };
- NSString *strDisplayText2 =@"Shadow Font";
- NSAttributedString *attributedText2 = [[NSAttributedStringalloc] initWithString:strDisplayText2attributes:attributes2];
- self.lblInfo2.attributedText= attributedText2;
- NSDictionary*subStrAttribute1 = @{
- NSForegroundColorAttributeName: [UIColorredColor],
- NSStrikethroughStyleAttributeName:@2
- };
- NSDictionary *subStrAttribute2 =@{
- NSForegroundColorAttributeName: [UIColorgreenColor]
- };
- NSString *strDisplayText3 =@"Red and Green";
- NSMutableAttributedString *attributedText3 = [[NSMutableAttributedStringalloc] initWithString:strDisplayText3];
- [attributedText3 setAttributes:subStrAttribute1range:NSMakeRange(0,3)];
- [attributedText3 setAttributes:subStrAttribute2range:NSMakeRange(8,5)];
- self.lblInfo3.attributedText= attributedText3;
- //段落样式设置
- NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
- paragraph.alignment = NSTextAlignmentJustified;
- paragraph.firstLineHeadIndent =20.0;
- paragraph.paragraphSpacingBefore = 10.0;
- paragraph.lineSpacing = 5;
- paragraph.hyphenationFactor =1.0;
- NSDictionary *attributes4 =@{
- NSForegroundColorAttributeName: [UIColorredColor],
- NSParagraphStyleAttributeName: paragraph
- };
- NSString *strDisplayText4 =@“iPad inspires creativity and ……”;
- NSAttributedString *attributedText4 = [[NSAttributedStringalloc] initWithString: strDisplayText4attributes:attributes4];
- self.lblInfo4.attributedText= attributedText4;

- 顶
- 0
NSAttributeString创建各种文字效果的更多相关文章
- CSS Gradient文字效果
你想创建的标题没有渲染和Photoshop每个标题吗?这里是一个简单的CSS技巧向您展示如何创建渐变文字效果,PNG图像(纯CSS,没有Javascript或Flash).你所需要的是一个空的< ...
- JAVA 跑马灯文字效果
JAVA跑马灯文字效果的实现: 1. 首先创建一个继承JFrame类的HorseRaceLightTextFrame窗体类,代码如下: package com.example.horseracelig ...
- css文字效果(文字剪贴蒙版,text-shodow的应用,文字排版等…)
.katex { display: inline-block; text-align: initial; } .katex { font-family: Consolas, Inconsolata, ...
- 第95天:CSS3 边框、背景和文字效果
1.CSS3边框: border-radius:CSS3圆角边框.在 CSS2 中添加圆角矩形需要技巧,我们必须为每个圆角使用不同的图片,在 CSS3 中,创建圆角是非常容易的,在 CSS3 中,bo ...
- css鼠标滑过出现文字效果
模仿淘宝上鼠标移动到商品图片时,出现的文字效果. 1.效果图 鼠标移动到粉红色的区域,则出现黄色部分. 2.代码 <!DOCTYPE ...
- Qt qml 模拟iphone slide to unlock 的聚光动画文字效果
模拟iphone slide to unlock 的聚光动画文字效果 /底层放淡文字 /前景放高亮文字+半透明遮罩 /动画移动遮罩 Author: surfsky.cnblogs.c ...
- Progress.js – 为页面上的任意对象创建进度条效果
Progress.js 是一个 JavaScript 和 CSS3 的库,它帮助开发人员为网页上的每个对象创建和管理进度条效果.你可以设计自己的模板,进度条或者干脆定制. 您可以使用 Progress ...
- 【转】使用jquery animate创建平滑滚动效果
这篇文章主要介绍了使用jquery animate创建平滑滚动效果,效果可以滚动到顶部.到底部或页面中指定地方,生要的是非常平滑,很舒服,需要的朋友可以参考下 滚动到顶部: $('.scroll_to ...
- as3.0:文字 效果
//文字描边效果var tf1 = _root.createTextField("tf1", _root.getNextHighestDepth(), 10, 10, 0, 0); ...
随机推荐
- 【Henu ACM Round #13 D】A Trivial Problem
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 123...n中末尾0的个数 只会由素因子2和5的个数决定且等于 Min{cnt[2],cnt[5]} 且素因子2的个数一定会比5多 ...
- Android.mk脚本推断文件是否存在
Android.mk 推断文件是否存在,若存在则复制该文件到某个文件夹 $(shell test -f [文件] && echo yes)的值假设是yes, 则文件存在,然后进行she ...
- js---对象 和 函数this
一:对象创建的方法 //普通 字面量形式 var obj = { name:'名字', fn:function(){ console.log(this.name); } } //new 实例 var ...
- js函数的解析与执行过程
function f(a,b,c){ alert(a);//函数字符串 alert(b); var b = 5; function a(){ } } f(1,2); //预处理 lexicalEnvi ...
- 5个jvm命令
本文是Neward & Associates的总裁Ted Neward为developerworks独家撰稿“你不知道5个……”系列中的一篇,JVM是多数开发人员视为理所当然的Java功能和性 ...
- netty实现TCP长连接
所用jar包 netty-all-4.1.30.Final.jar 密码:rzwe NettyConfig.java,存放连接的客户端 import io.netty.channel.group.Ch ...
- xml格式报文的拼装,和解析成实体类
我们的微信支付,使用的是第三方的支付,某银行的微信支持渠道.所有的接口请求.应答都是xml格式报文,这样就需要用到xml格式报文的拼装和解析,这儿简单讲一下. 拼接xml格式报文. 从页面表单提交和配 ...
- Tomcat之虚拟主机配置以及web应用配置
Tomcat之虚拟主机配置以及web应用配置 Tomcat文件夹结构例如以下: bin ---- 启动和关闭须要的bat文件所在的文件夹 conf --- 配置文件夹 lib --- tomcat执 ...
- sqlserver 导入excel数据
有的时候需要将excel数据导入到数据库中,这里介绍一下操作方法: 1.可能需要安装sqlserver的插件 [AccessDatabaseEngine],这个可以在网上早,很多. 2.安装插件后,右 ...
- Spring源码分析专题 —— 阅读指引
阅读源码的意义 更深入理解框架原理,印象更深刻 学习优秀的编程风格.编程技巧.设计思想 解决实际问题,如修复框架中的bug,或是参考框架源码,结合实际业务需求编写一个独有的框架 阅读源码的方法 首先是 ...