关键字高亮
来源:互联网 发布:长绸扇子淘宝 编辑:程序博客网 时间:2024/04/30 12:56
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *reuse = @"reuse"; LGSearchCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse]; if (!cell) { cell = [[[LGSearchCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuse] autorelease]; } LGModel *model = self.listArr[indexPath.row]; // 设置标签文字 NSMutableAttributedString *attributeString = [[NSMutableAttributedString alloc] initWithString:model.name]; // 获取标红的位置和长度 NSRange range = [model.name rangeOfString:self.keyWord]; // 设置标签文字的属性 [attributeString setAttributes:@{NSForegroundColorAttributeName: [UIColor redColor]} range:range]; [cell.leftImageView sd_setImageWithURL:[NSURL URLWithString:model.imgurl] placeholderImage:PLACEHOLDERIMAGE]; cell.nameLabel.text = model.name; // 高亮红字显示在nameLabel中 cell.nameLabel.attributedText = attributeString; cell.levelLabel.text = model.level; cell.priceLabel.text = model.pricebetween; return cell;}
0 0
- lucene高亮关键字
- lucene 关键字高亮
- ASP高亮关键字
- 高亮显示关键字
- 高亮显示关键字
- Java高亮关键字
- 高亮显示关键字
- 高亮显示关键字
- jquery高亮关键字
- vim高亮关键字
- 关键字高亮显示
- 关键字高亮显示
- qt关键字高亮
- 关键字高亮显示
- 搜索关键字高亮
- QTreewidgetItem关键字高亮
- C#高亮关键字
- 关键字高亮
- 使用C#打开网址(IE)
- Linux 下的定时任务实现 at 和 crontab
- 重磅!8大策略让你对抗机器学习数据集里的不均衡数据
- 最大熵理论及其应用
- requestWindowFeature()使用简介
- 关键字高亮
- eXtremeDB HA 306 312 error
- muduo库阅读(39)——Net部分:接收者Accpetor
- 在按钮事件上添加参数传递
- Ubuntu 15 下 Qt 配置mysql链接及基本操作
- html5桌面通知(Web Notifications)实例解析
- 数据库索引浅析
- mysql now() , curdate() , curtime()
- vs2013中如何安装OpencvSharp并使用