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); ...
随机推荐
- Spring MVC源码——Servlet WebApplicationContext
上一篇笔记(Spring MVC源码——Root WebApplicationContext)中记录了下 Root WebApplicationContext 的初始化代码.这一篇来看 Servlet ...
- Linux 设置文件默认打开方式
比如说我安装了一个绿色版的sublime(.tar解压出来的不是.deb) 但是现在我右键不能打开,不能添加为默认打开方式...这个时候就比较尴尬了... 我总不能每次都cd到安装目录下然后termi ...
- 【记录】无法读取配置节“AppSettings”,因为它缺少节声明
Web.config对大小写敏感, 把AppSettings改为appSettings即可.
- touch---创建文件或更改文件日期
- Objective-C ,ios,iphone开发基础:UIAlertView使用详解
UIAlertView使用详解 Ios中为我们提供了一个用来弹出提示框的类 UIAlertView,他类似于javascript中的alert 和c#中的MessageBox(); UIAlertVi ...
- Vue 学习记录<2>
一.Vue https://vue-loader.vuejs.org/zh-cn/ https://vuejs-templates.github.io/webpack/structure.html
- 论Node在构建超媒体API中的作用
论Node在构建超媒体API中的作用 作者:chszs,转载需注明. 博客主页:http://blog.csdn.net/chszs 超媒体即Hypermedia,是一种採用非线性网状结构对块状多媒体 ...
- 没有killall命令的解决方法
没有killall命令的解决方法 -bash: killall: command not found https://www.byte128.com/archives/231.html 执行killa ...
- 35.Node.js GET/POST请求
转自:http://www.runoob.com/nodejs/nodejs-module-system.html 在很多场景中,我们的服务器都需要跟用户的浏览器打交道,如表单提交. 表单提交到服务器 ...
- 使用Python开发轻量级的Web框架以及基于WSGI的服务器来实现一个网站页面
说明:该篇博客是博主一字一码编写的,实属不易,请尊重原创,谢谢大家! 目录 一丶项目说明 二丶数据准备 三丶使用网络TCP开发一个基于WSGI协议的Web服务器 四丶使用python3开发一个轻量级的 ...