// // JXSiDaiCell.m // shiku_im // // Created by 123 on 2020/6/4. // Copyright © 2020 Reese. All rights reserved. // #import "JXSiDaiCell.h" #import "UIButton+WebCache.h" #import "MJPhotoBrowser.h" #import "MJPhoto.h" @interface JXSiDaiCell() @property (weak, nonatomic) IBOutlet UIImageView *iconIMG; @property (weak, nonatomic) IBOutlet UILabel *titleName; @property (weak, nonatomic) IBOutlet UILabel *techerName; @property (weak, nonatomic) IBOutlet UILabel *techerLevel; @property (nonatomic,weak) IBOutlet UILabel *titleL; @property (nonatomic,weak) IBOutlet UILabel *awreResultL; @property (nonatomic,weak) IBOutlet UIButton *yuyueBtn; /**战果展示*/ @property (weak, nonatomic) IBOutlet UIView *awarView; @property (weak, nonatomic) IBOutlet UILabel *kechenPriceL; /**左边背景*/ @property (weak, nonatomic) IBOutlet UIView *leftView; //右边背景 @property (weak, nonatomic) IBOutlet UIView *kecView; @property (weak, nonatomic) IBOutlet UIView *zhanguoView; @end @implementation JXSiDaiCell - (void)awakeFromNib { [super awakeFromNib]; // Initialization code\ _leftView.layer.cornerRadius=5; _leftView.layer.masksToBounds=YES; _kecView.layer.cornerRadius=5; _kecView.layer.masksToBounds=YES; _yuyueBtn.layer.cornerRadius=3; _yuyueBtn.layer.masksToBounds=YES; [_yuyueBtn addTarget:self action:@selector(yuyueBtnClick:) forControlEvents:UIControlEventTouchUpInside]; } - (void)yuyueBtnClick:(UIButton *)sender{ if (_yuyueblock) { _yuyueblock(sender); } } + (instancetype)cellWithTableView:(UITableView *)tableView { static NSString *ID = @"JXSiDaiCell"; JXSiDaiCell *cell = [tableView dequeueReusableCellWithIdentifier:ID]; if (!cell) { cell = [[NSBundle mainBundle] loadNibNamed:@"JXSiDaiCell" owner:nil options:nil].firstObject; cell.selectionStyle=UITableViewCellSelectionStyleNone; } cell.backgroundColor=[UIColor clearColor]; return cell; } - (NSAttributedString *)stringHtml:(NSString *)htmlStr{ NSDictionary *optoins=@{NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType, NSFontAttributeName:[UIFont systemFontOfSize:14]}; NSData *data=[htmlStr dataUsingEncoding:NSUnicodeStringEncoding]; NSAttributedString *attributeString=[[NSAttributedString alloc] initWithData:data options:optoins documentAttributes:nil error:nil]; return attributeString; } -(void)setDictData:(NSDictionary *)dictData{ _dictData=dictData; self.titleName.text=[NSString stringWithFormat:@"%@",dictData[@"name"]]; [self.iconIMG sd_setImageWithURL:[NSURL URLWithString:dictData[@"photoUrl"]] placeholderImage:[UIImage imageNamed:@""]]; self.techerName.attributedText=[self stringHtml:[NSString stringWithFormat:@"%@",dictData[@"intro"]]]; self.techerLevel.attributedText=[self stringHtml:[NSString stringWithFormat:@"%@",dictData[@"message"]]]; self.titleL.attributedText=[self stringHtml:[NSString stringWithFormat:@"%@",dictData[@"income"]]]; CGFloat marginW=15; if (JX_SCREEN_WIDTH<414) { marginW=5; } CGFloat imageW=60; NSArray *imageS=dictData[@"achievement"]; for (int i=0; i