//
//  ScoreCollectionCell.m
//  gaotingshan
//
//  Created by MacBook Dq01 on 16/5/23.
//  Copyright © 2016年 Xu Mengzhu. All rights reserved.
//

#import "ScoreCollectionCell.h"

#define kMargin 5


@implementation ScoreCollectionCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.iconImageView];
        [self addSubview:self.pointsNameLabel];
        [self addSubview:self.nameLabel];
        [self addSubview:self.rankingLabel];
        [self addSubview:self.sportTimeLabel];
    }
    return self;
}

- (UIImageView *)iconImageView {
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 2, 15, 15)];
        _iconImageView.image = [UIImage imageNamed:@"ibeaicon"];
        //        _iconImageView.backgroundColor = [UIColor orangeColor];
    }
    return _iconImageView;
}

- (UILabel *)pointsNameLabel {
    if (_pointsNameLabel == nil) {
        _pointsNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, self.frame.size.width - 20, 20)];
        _pointsNameLabel.textAlignment = NSTextAlignmentLeft;
      //  _pointsNameLabel.backgroundColor = [UIColor cyanColor];
    }
    return _pointsNameLabel;
}

- (UILabel *)nameLabel {
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_pointsNameLabel.frame), self.frame.size.width, 20)];
        _nameLabel.textAlignment = NSTextAlignmentLeft;
       // _nameLabel.backgroundColor = [UIColor yellowColor];
    }
    return _nameLabel;
}

- (UILabel *)rankingLabel {
    if (_rankingLabel == nil) {
        _rankingLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_nameLabel.frame), self.frame.size.width, 20)];
        _rankingLabel.textAlignment = NSTextAlignmentLeft;
       // _rankingLabel.backgroundColor = [UIColor blueColor];
    }
    return _rankingLabel;
}

- (UILabel *)sportTimeLabel {
    if (_sportTimeLabel == nil) {
        _sportTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_rankingLabel.frame), self.frame.size.width, 20)];
        _sportTimeLabel.textAlignment = NSTextAlignmentLeft;
       // _restMileageLabel.backgroundColor = [UIColor purpleColor];
    }
    return _sportTimeLabel;
}

/*
#pragma mark 用成绩model设置cell
-(void)setWithScoreModel:(PersonScoreModel *)scoreModel
{
    self.pointsNameLabel.text = scoreModel.repeaterName;
    if (scoreModel.userName==nil) {
        self.nameLabel.text = @"姓名：";
    }
    else
    {
        self.nameLabel.text = [NSString stringWithFormat:@"姓名：%@",scoreModel.userName];
    }
    if ([scoreModel.eventTop intValue] == 10000) {
        self.rankingLabel.text = @"排名：暂无排名";
    }
    else
    {
        self.rankingLabel.text = [NSString stringWithFormat:@"排名：%@",scoreModel.eventTop];
    }
    if (scoreModel.sportTime == nil) {
        self.sportTimeLabel.text = @"用时：";
    }
    else{
        self.sportTimeLabel.text = [NSString stringWithFormat:@"用时：%@",scoreModel.sportTime];
    }
    
}
*/

@end
