IVTMyCenterTableViewCell.m
2.82 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
//
// IVTMyCenterTableViewCell.m
// IVTMeLiveTwo
//
// Created by XRG on 16/8/19.
// Copyright © 2016年 QLQ. All rights reserved.
//
#import "IVTMyCenterTableViewCell.h"
@interface IVTMyCenterTableViewCell ()
{
UIImageView *headerImageView;
UILabel *titleLabel;
}
@end
@implementation IVTMyCenterTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
__weak __typeof(self)weakSelf = self;
headerImageView = [[UIImageView alloc]init];
[self.contentView addSubview:headerImageView];
[headerImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.contentView.mas_left).offset(22);
make.centerY.equalTo(weakSelf.contentView.mas_centerY);
make.size.mas_equalTo(CGSizeMake(20, 20));
}];
titleLabel = [[UILabel alloc]init];
titleLabel.font = [UIFont systemFontOfSize:16];
titleLabel.textColor = UIColorFromRGBAlphaHex(0x5A5A5A, 1.0);
titleLabel.textAlignment = NSTextAlignmentLeft;
[self.contentView addSubview:titleLabel];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.contentView.mas_left).offset(68);
make.centerY.equalTo(weakSelf.contentView.mas_centerY);
make.size.mas_equalTo(CGSizeMake(120, 24));
}];
self.accessoryView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 57, 20)];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(50, 4, 7, 12)];
imageView.image = [UIImage imageNamed:@"我的更多键"];
[self.accessoryView addSubview:imageView];
UIImageView *lineImageView = [[UIImageView alloc]init];
lineImageView.backgroundColor = UIColorFromRGBAlphaHex(0xdcdcdc, 1.0);
[self.contentView addSubview:lineImageView];
[lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.contentView.mas_left).offset(68);
make.bottom.equalTo(weakSelf.contentView.mas_bottom);
make.width.mas_equalTo(kScreenWidth-68);
make.height.mas_equalTo(0.4);
}];
}
return self;
}
- (void)setImageName:(NSString *)imageName{
_imageName = imageName;
headerImageView.image = [UIImage imageNamed:_imageName];
}
- (void)setTitleString:(NSString *)titleString{
_titleString = titleString;
titleLabel.text = _titleString;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end