// // IfishTanSuoViewCell.m // Ifish // // Created by imac on 16/8/5. // Copyright © 2016年 lianxiang. All rights reserved. // #import "IfishTanSuoViewCell.h" #import "IfishUserDefaultHelper.h" @implementation IfishTanSuoViewCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code self.activityUnreadCount.layer.masksToBounds = YES; self.activityUnreadCount.layer.cornerRadius = self.activityUnreadCount.frame.size.height/2; } -(void)cellSetNewsImgAt:(TanSuoViewModel *)model atInex:(NSIndexPath*)indexPath { self.tanSuoHeaderImg.image = [UIImage imageNamed:model.headerImg]; self.tanSuoDetailTitle.text = model.detailL; //设置标题 富文本标题 后加图片 NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:model.nameT]; NSTextAttachment *attch = [[NSTextAttachment alloc] init]; if (indexPath.row ==1&&indexPath.section ==0) { attch.image = [UIImage imageNamed:@"explore_hot_label"]; attch.bounds = CGRectMake(0,5, 24, 13); }else if (indexPath.row ==0 &&indexPath.section ==0){ attch.image = [UIImage imageNamed:@"explore_new_label"]; attch.bounds = CGRectMake(0,5, 24, 13); }else if (indexPath.row ==0 &&indexPath.section ==1){ attch.image = [UIImage imageNamed:@"explore_iocn_authentication"]; attch.bounds = CGRectMake(0,0, 12, 10); } NSAttributedString *str=[NSAttributedString attributedStringWithAttachment:attch]; [attri appendAttributedString:str]; self.tanSuoTitle.attributedText = attri; } -(void)userActivityUnreadCount:(NSString *)allActivityCount atInex:(NSIndexPath*)indexPath { if (indexPath.section==0&&indexPath.row==5) { self.activityUnreadCount.hidden = NO; NSString *curentMaxId = [IfishUserDefaultHelper localCurrentUserActivityMaxId]; if (!curentMaxId) { //未请求过动态列表接口时 //第一次进入app if (allActivityCount.integerValue >=999) { self.activityUnreadCount.text = [NSString stringWithFormat:@"999+"]; }else{ self.activityUnreadCount.text = [NSString stringWithFormat:@"%@",allActivityCount]; } self.activityUnreadCount.hidden = NO; }else{ NSInteger maxId ; maxId = [curentMaxId integerValue]; NSInteger unradCount = allActivityCount.integerValue -maxId ; if (unradCount>=999) { self.activityUnreadCount.text = [NSString stringWithFormat:@"999+"]; }else{ self.activityUnreadCount.text = [NSString stringWithFormat:@"%ld",(long)unradCount]; if (unradCount<=0) { self.activityUnreadCount.hidden = YES; } } } }else{ self.activityUnreadCount.hidden = YES; } } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } @end