NSMutableAttributedString
来源:互联网 发布:剑三捏脸数据萝莉万花 编辑:程序博客网 时间:2024/03/29 20:15
NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:title];
NSRange range = NSMakeRange(0, [attrString length]);
[attrString beginEditing];
[attrString addAttribute:NSLinkAttributeName value:aURL range:range];
// make the text appear in blue
[attrString addAttribute:NSForegroundColorAttributeName value:[NSColor blueColor] range:range];
// next make the text appear with an underline
[attrString addAttribute:NSUnderlineStyleAttributeName value:[NSNumbernumberWithInteger:NSSingleUnderlineStyle] range:range];
// allow truncation
NSMutableParagraphStyle *ps = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
[ps setLineBreakMode:NSLineBreakByTruncatingTail];
[attrString addAttribute:NSParagraphStyleAttributeName value:ps range:range];
[ps release];
[attrString endEditing];
return [attrString autorelease];
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@
"Using NSAttributed String"
];
3
[str addAttribute:NSForegroundColorAttributeName value:[UIColor blueColor] range:NSMakeRange(0,5)];
4
[str addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(6,12)];
5
[str addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:NSMakeRange(19,6)];
6
[str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@
"Arial-BoldItalicMT"
size:30.0] range:NSMakeRange(0, 5)];
7
[str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@
"HelveticaNeue-Bold"
size:30.0] range:NSMakeRange(6, 12)];
8
[str addAttribute:NSFontAttributeName value:[UIFont fontWithName:@
"Courier-BoldOblique"
size:30.0] range:NSMakeRange(19, 6)];
9
attrLabel.attributedText = str;
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString
- NSMutableAttributedString 使用
- NSMutableAttributedString使用
- NSMutableAttributedString 文字处理 。。。
- NSMutableAttributedString使用
- NSMutableAttributedString初探
- NSMutableAttributedString mode
- MYSQL如何忽略重复记录,添加唯一索引
- loner_li 机试题 一列数的规则如下: 1、1、2、3、5、8、13、21、34...... 求第30位数是多少, 用递归算法实现。
- 一球从M米高度自由下落,每次落地后返回原高度的一半,再落下。它在第N次落地时反弹多高?共经过多少米?保留两位小数
- Mysql 日志配置及查看
- Log4j的isdebugEnabled的作用 从isdebugEnabled使用 思考项目中代码的效率
- NSMutableAttributedString
- 【VC++6.0】MFC关于CString中英文混合串的截取出现乱码解决方法
- 详解大端模式和小端模式
- android显示动态条形图
- 10天学会英语常见词根后缀
- ocp-047-98
- hdu 1054 Strategic Game(tree dp)
- poj 2184 Cow Exhibition
- 深入了解Json转变为map的思想,附源代码2