// // ReplayMeCell.m // smartRhino // // Created by niuzhen on 2020/6/11. // Copyright © 2020 tederen. All rights reserved. // #import "ReplayMeCell.h" @implementation ReplayMeCell - (void)awakeFromNib { [super awakeFromNib]; self.iconV.layer.cornerRadius = 5.f; self.iconV.layer.masksToBounds = YES; self.subView.layer.cornerRadius = 5.f; self.subView.layer.masksToBounds = YES; self.subView.layer.borderColor = UIColorHex(0xE5E5E5).CGColor; self.subView.layer.borderWidth = 0.5f; self.redV.layer.cornerRadius = 5.f; self.redV.layer.masksToBounds = YES; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } + (ReplayMeCell *)configCell:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath{ static NSString *cellIdentifer = @"ReplayMeCell"; ReplayMeCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer]; if (cell == nil) { cell = [[[NSBundle mainBundle] loadNibNamed:@"ReplayMeCell" owner:nil options:nil] objectAtIndex:0]; } return cell; } - (void)setDatasubText { NSString * str = @"童文洁: 这群孩子用思维导图刷新了学习力"; NSString * substr = @"来自 话题"; self.subTitleL.attributedText = [self checkOfString:str withSearchText:@"童文洁:"]; self.subComeL.attributedText = [self checkOfString:substr withSearchText:@"话题"]; } - (void)setDataWithText:(NSString *)text { NSString * str = @"数字出版行业会议的积极推动者"; self.contentL.attributedText = [self checkOfString:str withSearchText:text]; } - (NSMutableAttributedString *)checkOfString:(NSString *)infoStr withSearchText:(NSString *)text { if (infoStr.length == 0) { return nil; } NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:infoStr]; [attrString addAttribute:(NSString *)NSForegroundColorAttributeName value:UIColorHex(0x1F87DB) range:[infoStr rangeOfString:text]]; return attrString; } @end