ECModifyingGroupCollCell.m
4.3 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//
// ECModifyingGroupCollCell.m
// EducationContact
//
// Created by Apple on 2022/8/1.
//
#import "ECModifyingGroupCollCell.h"
@interface ECModifyingGroupCollCell ()<UITextFieldDelegate>
@property (nonatomic,strong) UITextField *textField;
@property (nonatomic,strong) UILabel *lab;
@property (nonatomic,strong) UIImageView *imgV;
@property (nonatomic,strong) UIImageView *defImgV;
@end
@implementation ECModifyingGroupCollCell
-(instancetype)initWithFrame:(CGRect)frame
{
if (self = [super initWithFrame:frame]) {
[self creatCellView];
}
return self;
}
-(void)creatCellView{
self.contentView.backgroundColor = [UIColor whiteColor];
self.textField = [[UITextField alloc]init];
self.textField.placeholder = @"请输入";
self.textField.font = [UIFont systemFontOfSize:14];
self.textField.textColor = COLOR_WITH_HEX(0x333333);
self.textField.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.textField];
self.textField.sd_layout.leftSpaceToView(self.contentView, 0).rightSpaceToView(self.contentView, 8).topSpaceToView(self.contentView, 8).bottomSpaceToView(self.contentView, 0);
[self.textField.layer setMasksToBounds:YES];
[self.textField.layer setBorderWidth:1];
[self.textField.layer setBorderColor:COLOR_WITH_HEX(0xB1BDC2).CGColor];
[self.textField.layer setCornerRadius:6];
self.textField.hidden = YES;
self.textField.delegate = self;
self.lab = [[UILabel alloc]init];
self.lab.font = [UIFont systemFontOfSize:14];
self.lab.textColor = COLOR_WITH_HEX(0x333333);
self.lab.textAlignment = NSTextAlignmentCenter;
[self.contentView addSubview:self.lab];
self.lab.sd_layout.leftSpaceToView(self.contentView, 0).rightSpaceToView(self.contentView, 8).topSpaceToView(self.contentView, 8).bottomSpaceToView(self.contentView, 0);
[self.lab.layer setMasksToBounds:YES];
[self.lab.layer setBorderWidth:1];
[self.lab.layer setBorderColor:COLOR_WITH_HEX(0xB1BDC2).CGColor];
[self.lab.layer setCornerRadius:6];
self.lab.hidden = YES;
self.imgV = [[UIImageView alloc]init];
[self.contentView addSubview:self.imgV];
self.imgV.sd_layout.leftSpaceToView(self.contentView, 0).rightSpaceToView(self.contentView, 8).topSpaceToView(self.contentView, 8).bottomSpaceToView(self.contentView, 0);
self.imgV.hidden = YES;
self.defImgV = [[UIImageView alloc]init];
[self.contentView addSubview:self.defImgV];
self.defImgV.sd_layout.leftSpaceToView(self.contentView, 0).rightSpaceToView(self.contentView, 8).topSpaceToView(self.contentView, 8).bottomSpaceToView(self.contentView, 0);
self.defImgV.hidden = YES;
self.deleBtn = [[UIButton alloc]init];
[self.deleBtn setImage:[UIImage imageNamed:@"close_orange_icon"] forState:UIControlStateNormal];
[self.contentView addSubview:self.deleBtn];
self.deleBtn.sd_layout.rightSpaceToView(self.contentView, 0).topSpaceToView(self.contentView, 0).widthIs(16).heightIs(16);
}
-(void)setImgModel:(ECGroupImagesModel *)imgModel
{
self.lab.hidden = YES;
self.textField.hidden = YES;
self.imgV.hidden = NO;
self.defImgV.hidden = YES;
_imgModel = imgModel;
if (imgModel.cdnUrl != nil) {
[self.imgV sd_setImageWithURL:[NSURL URLWithString:imgModel.cdnUrl]];
}
}
-(void)setImgnew:(UIImage *)imgnew
{
self.lab.hidden = YES;
self.textField.hidden = YES;
self.imgV.hidden = NO;
self.defImgV.hidden = YES;
self.imgV.image = imgnew;
}
-(void)setTitleModel:(NSString *)titleModel
{
self.lab.hidden = NO;
self.textField.hidden = NO;
self.imgV.hidden = YES;
self.defImgV.hidden = YES;
_titleModel = titleModel;
if ([titleModel isEqualToString:@""] || titleModel == nil) {
self.textField.hidden = NO;
self.lab.hidden = YES;
}else{
self.textField.hidden = YES;
self.lab.text = titleModel;
self.lab.hidden = NO;
}
}
-(void)setDefImg:(UIImage *)defImg
{
self.lab.hidden = YES;
self.textField.hidden = YES;
self.imgV.hidden = YES;
self.defImgV.hidden = NO;
self.defImgV.image = defImg;
}
-(void)textFieldDidEndEditing:(UITextField *)textField
{
if ([self.deletegate respondsToSelector:@selector(baclCellStr:andImgStr:andTag:)]) {
[self.deletegate baclCellStr:textField.text andImgStr:@"" andTag:self.tag];
}
}
@end