服文本
来源:互联网 发布:医疗器械软件哪家好 编辑:程序博客网 时间:2024/04/28 07:53
UILabel* noteLabel = [[UILabel alloc] init];
noteLabel.frame = CGRectMake(60, 100, 200, 100);
noteLabel.textColor = [UIColor blackColor];
noteLabel.numberOfLines = 2;
NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:@"点击注册按钮,即表示您已同意隐私条款和服务协议"];
NSRange redRange = NSMakeRange([[noteStr string] rangeOfString:@"注册"].location, [[noteStr string] rangeOfString:@"注册"].length);
[noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:redRange];
NSRange redRangeTwo = NSMakeRange([[noteStr string] rangeOfString:@"同意"].location, [[noteStr string] rangeOfString:@"同意"].length);
[noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:redRangeTwo];
[noteLabel setAttributedText:noteStr];
[noteLabel sizeToFit];
[self.view addSubview:noteLabel];
noteLabel.frame = CGRectMake(60, 100, 200, 100);
noteLabel.textColor = [UIColor blackColor];
noteLabel.numberOfLines = 2;
NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:@"点击注册按钮,即表示您已同意隐私条款和服务协议"];
NSRange redRange = NSMakeRange([[noteStr string] rangeOfString:@"注册"].location, [[noteStr string] rangeOfString:@"注册"].length);
[noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:redRange];
NSRange redRangeTwo = NSMakeRange([[noteStr string] rangeOfString:@"同意"].location, [[noteStr string] rangeOfString:@"同意"].length);
[noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor greenColor] range:redRangeTwo];
[noteLabel setAttributedText:noteStr];
[noteLabel sizeToFit];
[self.view addSubview:noteLabel];
0 0
- 服文本
- 文本
- 文本
- 文本
- 文本
- 文本
- 文本
- 文本
- 文本
- 文本
- 文本
- 文本构造文本图片
- 文本函数
- 输出文本
- 读写文本
- 对齐文本
- 文本编辑器
- 文本挖掘
- 关于input的file之change事件只第一次有效的问题
- 如何修改Apache的默认站点目录
- read和write系统调用以及getchar的实现
- Scala:建立对象
- Android 百度地图开发 坐标误差问题
- 服文本
- 通过分组函数实现高效查询
- 关于V7包下AlertDialog调用Dismiss的解决方法
- 关于梦行monxin网络商城如何查询开店邀请码的方法
- [leetcode] 【字符串】 65. Valid Number
- 框架和设计模式的区别
- Web服务器工作原理概述
- mongodb 数据操作
- spark 开发遇到问题