AttributedString
来源:互联网 发布:mac flash player 21 编辑:程序博客网 时间:2024/06/11 01:06
AttributedString的初始化
通常初始化AttributedString的方式有两种:
NSString *str = @"Hello, the Word!"; NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithString: str]; UILabel *textLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 64, 300, 50)]; textLabel1.numberOfLines = 0; textLabel1.textAlignment = NSTextAlignmentLeft; [self.view addSubview:textLabel1]; NSString *str = @"textLabel1: Hello, the Word!"; NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithString:str]; [attribute addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"zapfino" size:15.0] range:NSMakeRange(0, str.length)]; [attribute addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(12, 4)]; [attribute addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(16, 5)]; textLabel1.attributedText = attribute;
0 0
- AttributedString
- AttributedString
- AttributedString
- iOS AttributedString
- AttributedString之入门
- iOS 富文本 AttributedString
- AttributedString设置字体属性
- UILabel的AttributedString设置
- AttributedString创建富文本
- iOS AttributedString 富文本
- UILabel中AttributedString的使用
- AttributedString属性字符串的使用方法
- iOS开发:富文本AttributedString
- iOS富文本字符串AttributedString详解
- iOS: 富文本AttributedString的详解
- iOS富文本字符串AttributedString详解
- 用AttributedString,来制作简单地描边效果
- UILabel属性, AttributedString字符串属性 (从网络搜集整理)
- kmp单片自动机
- POJ 1661 Help Jimmy
- Xcode 配置 路径
- 各大牛逼网站推荐系统
- Android JNI学习笔记2
- AttributedString
- 秒杀核心设计(减库存部分)-防超卖与高并发
- 转-android沉浸式状态栏:Translucent System Bar 的最佳实践
- WPF获取键盘状态(如WPF组合键)
- activity管理
- 最大子序列和
- Java反射和工厂模式
- 文章的相关性对网站优化到底有多重要?
- 每天一命令(15)df - report file system disk space usage