You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

84 lines
2.9 KiB

//
// RankingMyListTableViewCell.m
// tongxin
//
// Created by WeiChaoZheng on 2018/11/6.
// Copyright © 2018年 xTT. All rights reserved.
//
#import "RankingMyListTableViewCell.h"
#import "Step.h"
@implementation RankingMyListTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
//隐藏 排名
self.listIdentLabel.backgroundColor = [UIColor clearColor];
// self.listIdentLabel.layer.cornerRadius = 10;
// self.listIdentLabel.layer.masksToBounds = YES;
self.listIdentLabel.adjustsFontSizeToFitWidth = YES;
self.listIdentLabel.hidden = YES;
self.deviceImageView.layer.cornerRadius = 20;
self.deviceImageView.layer.masksToBounds = YES;
self.stepNumLabel.textColor = mainColor;
self.selectionStyle = UITableViewCellSelectionStyleNone;
self.backgroundColor = [UIColor clearColor];
self.contentView.backgroundColor = [UIColor clearColor];
}
-(void)setLineViewHidden:(BOOL)isHidden{
[self.lineView setHidden:isHidden];
// UIRectCorner corners = UIRectCornerBottomRight | UIRectCornerBottomLeft;
// if(isHidden){
// [self setBorderWithCornerRadius:5 borderWidth:0 borderColor:[UIColor clearColor] type:corners];
// }else{
// [self setBorderWithCornerRadius:0 borderWidth:0 borderColor:[UIColor clearColor] type:corners];
// }
}
-(void)setMyDataWith:(Step*)step{
self.stepNumLabel.text = [NSString stringWithFormat:@"%@步",step.num];
// [self setImageView:self.deviceImageView WithStepModel:step];
//根据男女区分
NSString *defaultIcon = @"";
if([step.sex isEqualToString:@"girl"]){
defaultIcon = @"icon_girl_head_portrait_1";
}else{
defaultIcon = @"icon_boy_head_portrait_1";
}
if(step.avator != nil && [step.avator containsString:@"http"] && ![step.avator containsString:@"/default.jpg"]){
[self.deviceImageView sd_setImageWithURL:[NSURL URLWithString:step.avator] placeholderImage:[UIImage imageNamed:defaultIcon]];
}else{
self.deviceImageView.image = [UIImage imageNamed:defaultIcon];
}
self.nameLabel.text = step.name;
if (step.my_ranking == nil || step.my_ranking.intValue == 0 ){
self.detailLabel.text = @"未进入排行榜";
self.detailLabel.textColor = [UIColor lightGrayColor];
}else{
self.detailLabel.textColor = mainColor;
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
formatter.numberStyle = kCFNumberFormatterRoundHalfDown;
NSString *numberStr = [formatter stringFromNumber:[NSNumber numberWithInt:step.my_ranking.intValue]];
self.detailLabel.text = [NSString stringWithFormat:@"第%@名",numberStr];
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end