IVTMyBlackListTableViewCell.m
3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//
// IVTMyBlackListTableViewCell.m
// IVTMeLiveTwo
//
// Created by XRG on 16/8/24.
// Copyright © 2016年 QLQ. All rights reserved.
//
#import "IVTMyBlackListTableViewCell.h"
#import "NameSexLevelView.h"
@interface IVTMyBlackListTableViewCell ()
{
UIImageView *headIcon;
NameSexLevelView *nameSexLevelView;
UILabel *mark;
}
@end
@implementation IVTMyBlackListTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
__unsafe_unretained typeof (self) wself = self;
headIcon = [[UIImageView alloc] init];
headIcon.layer.masksToBounds = YES; //没这句话它圆不起来
headIcon.layer.cornerRadius = 20.0; //设置图片圆角的尺度
headIcon.image = [UIImage imageNamed:@"关注-头像"];
[self.contentView addSubview:headIcon];
[headIcon mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(wself.contentView.mas_left).with.offset(12);
make.centerY.equalTo(wself.contentView);
make.size.mas_equalTo(CGSizeMake(40, 40));
}];
nameSexLevelView = [[NameSexLevelView alloc]init];
nameSexLevelView.userNickNameColor = UIColorFromRGBAlphaHex(0x343434, 1.0);
[self.contentView addSubview:nameSexLevelView];
[nameSexLevelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(wself.contentView.mas_top).offset(10);
make.left.equalTo(headIcon.mas_right).offset(10);
make.width.mas_equalTo(50);
make.height.mas_equalTo(18);
}];
mark = [[UILabel alloc]init];
mark.backgroundColor = [UIColor clearColor];
mark.textColor = [UIColor YXColorWithHexCode:@"#8d8d8d"];
mark.font = [UIFont YXFontOfSize:11];
mark.textAlignment = NSTextAlignmentLeft;
[self.contentView addSubview:mark];
[mark mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(headIcon.mas_right).with.offset(10);
make.right.equalTo(wself.contentView.mas_right).with.offset(-50);
make.top.equalTo(nameSexLevelView.mas_bottom).offset(5);
make.height.mas_equalTo(15);
}];
UIImageView *lineImageView = [[UIImageView alloc]init];
lineImageView.backgroundColor = UIColorFromRGBAlphaHex(0xdcdcdc, 1.0);
[self.contentView addSubview:lineImageView];
[lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(wself.contentView.mas_left).offset(62);
make.bottom.equalTo(wself.contentView.mas_bottom);
make.width.mas_equalTo(kScreenWidth-62);
make.height.mas_equalTo(0.4);
}];
}
return self;
}
- (void)setEntity:(NSDictionary *)entity{
_entity = entity;
if (![[_entity valueForKey:@"avatar"] isEqualToString:@"http://me.demo.bjivt.com/api/avatar.png"]){
[headIcon sd_setImageWithURL:[NSURL URLWithString:[_entity valueForKey:@"avatar"]]];
}else{
headIcon.image = [UIImage imageNamed:@"占位头像"];
}
nameSexLevelView.userNickName = [_entity[@"name"] base64DecodedToString];
nameSexLevelView.userSex = _entity[@"sex"];
nameSexLevelView.userLevel = _entity[@"level"];
mark.text = [_entity[@"signature"] base64DecodedToString];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end