-
Notifications
You must be signed in to change notification settings - Fork 0
/
3AE2E9B4-BAEA-4091-845F-EA2010C23A36.codesnippet
108 lines (79 loc) · 3.08 KB
/
3AE2E9B4-BAEA-4091-845F-EA2010C23A36.codesnippet
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
103
104
105
106
107
108
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDECodeSnippetCompletionPrefix</key>
<string>KN_cellViewM</string>
<key>IDECodeSnippetCompletionScopes</key>
<array>
<string>All</string>
</array>
<key>IDECodeSnippetContents</key>
<string>-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
self.selectionStyle = UITableViewCellSelectionStyleNone;//去掉选中效果
[self selfInit];
[self createSubView];
[self bindViewModel];
}
return self;
}
- (void)bindViewModel {
}
- (void)selfInit{
self.contentView.backgroundColor = kcellColor;
}
- (void)createSubView {
[self cellView];
}
static NSString *identifier = @"QCTSelectaNewProductTableViewCell";//QCTCheckOutViewcellSection4topTableViewCell
+ (instancetype) tableViewCellWithTableView:(UITableView *) tableView{
QCTSelectaNewProductTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (cell == nil) {// ------并不会执行
cell = [[[self class] alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
}
return cell;
}
+ (instancetype) tableViewCellWithTableView:(UITableView *) tableView block:(void (^)(id sender))block models:(id) models {
QCTSelectaNewProductTableViewCell *cell = [self tableViewCellWithTableView:tableView];
if (block) {
cell.block = block;
}
cell.models = models;
return cell;
}
#pragma mark - ******** model
- (void)setModels:( id)models{
_models =models;
self.cellView.models = models;
}
- (QCTQCTSelectaNewProductTableViewCellView *)cellView{
if (nil == _cellView) {
QCTQCTSelectaNewProductTableViewCellView *tmpView = [[QCTQCTSelectaNewProductTableViewCellView alloc]init];
_cellView = tmpView;
[tmpView setBackgroundColor:kcellColor];
[self.contentView addSubview:_cellView];
__weak __typeof__(self) weakSelf = self;
[_cellView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(weakSelf.contentView).offset(kAdjustRatio(25));
make.right.equalTo(weakSelf.contentView).offset(- kAdjustRatio(25));
make.top.equalTo(weakSelf.contentView).offset(kAdjustRatio(0));
make.bottom.equalTo(weakSelf.contentView).offset(kAdjustRatio(0));
}];
}
return _cellView;
}
</string>
<key>IDECodeSnippetIdentifier</key>
<string>3AE2E9B4-BAEA-4091-845F-EA2010C23A36</string>
<key>IDECodeSnippetLanguage</key>
<string>Xcode.SourceCodeLanguage.Generic</string>
<key>IDECodeSnippetTitle</key>
<string>KN_cellViewM</string>
<key>IDECodeSnippetUserSnippet</key>
<true/>
<key>IDECodeSnippetVersion</key>
<integer>2</integer>
</dict>
</plist>