CNLiveSettingTableViewCell.m
2.69 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
//
// CNLiveSettingTableViewCell.m
// CNLiveScioLive
//
// Created by CNLive-zxw on 2018/9/20.
// Copyright © 2018年 CNLive. All rights reserved.
//
#import "CNLiveSettingTableViewCell.h"
@interface CNLiveSettingTableViewCell()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *detailsLabel;
@property (nonatomic, strong) UIImageView *line;
@end
@implementation CNLiveSettingTableViewCell
static const NSInteger margin = 10;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.numberOfLines = 1;
_titleLabel.textColor = HEXCOLOR(0x333333);
_titleLabel.font = [UIFont systemFontOfSize:15];
[self.contentView addSubview:_titleLabel];
_detailsLabel = [[UILabel alloc] init];
_detailsLabel.numberOfLines = 1;
_detailsLabel.textAlignment = NSTextAlignmentRight;
_detailsLabel.textColor = HEXCOLOR(0x333333);
_detailsLabel.font = [UIFont systemFontOfSize:15];
[self.contentView addSubview:_detailsLabel];
_line = [[UIImageView alloc] init];
_line.backgroundColor = Color_Line;
[self.contentView addSubview:_line];
}
return self;
}
- (void)setName:(NSString *)name{
_name = name;
_titleLabel.text = name;
}
-(void)setDetails:(NSString *)details{
_details = details;
_detailsLabel.text = details;
}
- (void)layoutSubviews{
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.contentView.mas_left).with.offset(margin);
make.top.equalTo(self.contentView.mas_top).with.offset(0);
make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0);
make.right.equalTo(self.contentView.mas_right).with.offset(-100);
}];
[_detailsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.contentView.mas_right).with.offset(-margin);
make.top.equalTo(self.contentView.mas_top).with.offset(0);
make.bottom.equalTo(self.contentView.mas_bottom).with.offset(0);
make.width.offset(200);
}];
// [_line mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.equalTo(self.contentView.mas_left).with.offset(0);
// make.right.equalTo(self.contentView.mas_right).with.offset(0);
// make.bottom.equalTo(self.contentView.mas_bottom).with.offset(-0.5);
// make.height.offset(0.5);
//
// }];
_line.frame = CGRectMake(0, self.contentView.height-0.5, MainScreenWidth, 0.5);
}
@end