Attributes-iOS初学
来源:互联网 发布:c语言软件 编辑:程序博客网 时间:2024/05/29 19:47
Attributes-iOS初学
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. //获取可变attributes NSMutableAttributedString *title = [[NSMutableAttributedString alloc]initWithString:self.outlineButton.currentTitle]; //设置attributes [title setAttributes:@{NSStrokeWidthAttributeName:@3, NSStrokeColorAttributeName:self.outlineButton.tintColor} range:NSMakeRange(0, [title length])]; //attribute放回 [self.outlineButton setAttributedTitle:title forState:UIControlStateNormal];}
@-3:描边+填充。
[self.body.textStorage addAttributes:@{NSStrokeWidthAttributeName:@-3, NSStrokeColorAttributeName:[UIColor blackColor]} range:self.body.selectedRange];
@3:只描边,不填充,字体颜色失效。
[self.body.textStorage addAttributes:@{NSStrokeWidthAttributeName:@3, NSStrokeColorAttributeName:[UIColor blackColor]} range:self.body.selectedRange];
设置颜色:
- (IBAction)changeColor:(UIButton *)sender{ [self.body.textStorage addAttribute:NSForegroundColorAttributeName value:sender.backgroundColor //通过sender传递选中颜色。 range:self.body.selectedRange];}
1 0
- Attributes-iOS初学
- iOS 文字属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- iOS- 详解文本属性Attributes
- Crosswalk/XwalkView研究
- 推荐系统经典论文文献及业界应用
- Codeforces Round #347 (Div. 2) B. Rebus(给你一个等式里面只含加减号凑出一个数)
- Scrapy使用telnet查看组件的利用率
- BitCode
- Attributes-iOS初学
- hbase开发环境搭建及运行hbase小实例
- Ubuntu 14.04中安装最新版Eclipse
- Android模拟HOME键返回效果的方法
- JS中的id和name之间的区别和使用分析
- 排序之快速排序
- 设定自己的代码风格--Android学习笔记5
- linux下ubuntu操作系统的几个软件安装卸载相关命令
- 二叉排序树-Java实现