123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- //
- // XYInviteFriendsHistoryCell.m
- // Starbuds
- //
- // Created by gy on 2020/6/19.
- // Copyright © 2020 翟玉磊. All rights reserved.
- //
- #import "XYInviteFriendsHistoryCell.h"
- #import "XYUserLevelLabel.h"
- @implementation XYInviteFriendsHistoryInfo
- @end
- @interface XYInviteFriendsHistoryCell()
- @property (nonatomic, strong) UIImageView *avatarImgView;
- @property (nonatomic, strong) UILabel *nameLab;
- @property (nonatomic, strong) XYUserLevelLabel *levelView;
- @property (nonatomic, strong) UILabel *timeLab;
- @property (nonatomic, strong) UILabel *lineLab;
- @end
- @implementation XYInviteFriendsHistoryCell
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
- [self setup];
- }
- return self;
- }
- - (void)setup{
- self.contentView.backgroundColor = [UIColor whiteColor];
- [self avatarImgView];
- [self nameLab];
- [self levelView];
- [self timeLab];
- [self lineLab];
- }
- - (void)reload:(XYInviteFriendsHistoryInfo *)info{
- [self.avatarImgView sd_setImageWithURL:[NSURL URLWithString:info.avatar] placeholderImage:placeholderImage()];
- self.nameLab.text = info.name;
- [self.levelView configUserLevel:[info.level integerValue] shinyStatus:YES];
- self.timeLab.text = info.time;
- }
- - (UIImageView *)avatarImgView{
- if (_avatarImgView == nil) {
- _avatarImgView = [[UIImageView alloc] init];
- _avatarImgView.image = placeholderImage();
- _avatarImgView.contentMode = UIViewContentModeScaleAspectFill;
- [self.contentView addSubview:_avatarImgView];
- [_avatarImgView mas_makeConstraints:^(MASConstraintMaker *make) {;
- make.left.equalTo(self.mas_left).offset(21);
- make.centerY.equalTo(self.mas_centerY).offset(0);
- make.width.offset(48);
- make.height.offset(48);
- }];
- [_avatarImgView layoutIfNeeded];
- kViewRadius(_avatarImgView, 24);
- }
- return _avatarImgView;
- }
- - (UILabel *)nameLab{
- if (_nameLab == nil) {
- _nameLab = [[UILabel alloc] init];
- _nameLab.text = @"";
- _nameLab.textAlignment = NSTextAlignmentLeft;
- _nameLab.textColor = [UIColor colorWithHexString:@"#303133" alpha:1];
- _nameLab.font = [UIFont fontWithName:kPFSCMediumFont size:14];
- [_nameLab sizeToFit];
- [self.contentView addSubview:_nameLab];
- [_nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.avatarImgView.mas_right).offset(10);
- make.top.equalTo(self.avatarImgView.mas_top).offset(0);
- }];
- [_nameLab layoutIfNeeded];
- }
- return _nameLab;
- }
- - (XYUserLevelLabel *)levelView{
- if (_levelView == nil) {
- _levelView = [[XYUserLevelLabel alloc] init];
- [_levelView sizeToFit];
- [self.contentView addSubview:_levelView];
- [_levelView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLab.mas_right).offset(6);
- make.centerY.equalTo(self.nameLab.mas_centerY).offset(0);
- make.width.offset(44);
- make.height.offset(20);
- }];
- [_levelView layoutIfNeeded];
- }
- return _levelView;
- }
- - (UILabel *)timeLab{
- if (_timeLab == nil) {
- _timeLab = [[UILabel alloc] init];
- _timeLab.text = @"";
- _timeLab.textAlignment = NSTextAlignmentLeft;
- _timeLab.textColor = [UIColor colorWithHexString:@"#909399" alpha:1];
- _timeLab.font = [UIFont fontWithName:kPFSCFont size:12];
- [_timeLab sizeToFit];
- [self.contentView addSubview:_timeLab];
- [_timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.nameLab.mas_left).offset(0);
- make.top.equalTo(self.nameLab.mas_bottom).offset(3);
- }];
- [_timeLab layoutIfNeeded];
- }
- return _timeLab;
- }
- - (UILabel *)lineLab{
- if (_lineLab == nil) {
- _lineLab = [[UILabel alloc] init];
- _lineLab.backgroundColor = [UIColor colorWithHexString:@"#EBEEF5" alpha:1];
- [self.contentView addSubview:_lineLab];
- [_lineLab mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.mas_left).offset(0);
- make.top.equalTo(self.mas_bottom).offset(0);
- make.width.offset(kScreenWidth);
- make.height.offset(0.5);
- }];
- [_lineLab layoutIfNeeded];
- }
- return _lineLab;
- }
- - (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
-
- // Configure the view for the selected state
- }
- @end
|