admin
2023-04-21 0b3a4aaf99ea251bc8e27b96115288f0988fcffe
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
//
//  SearchCell.m
//  BuWanVideo2.0
//
//  Created by Aeline on 2021/6/26.
//  Copyright © 2021 com.yeshi.buwansheque.ios. All rights reserved.
//
 
#import "SearchCell.h"
 
@interface SearchCell ()
 
@property (nonatomic, nullable, strong) UIImageView *imageViewIcon;
@property (nonatomic, nullable, strong) UILabel *labelTitle;
@property (nonatomic, nullable, strong) UIImageView *imageViewArrow;
 
@property (nonatomic, nullable, strong) UIView *line;
@end
 
@implementation SearchCell
 
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
 
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}
 
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;//设置cell点击效果
        [self setupViewConfig];
    }
    return self;
}
 
- (void)setupViewConfig {
    [self.contentView addSubview:self.imageViewIcon];
    [self.contentView addSubview:self.imageViewArrow];
    [self.contentView addSubview:self.labelTitle];
  
    [self.contentView addSubview:self.line];
    
    self.imageViewIcon.sd_layout.leftSpaceToView(self.contentView, 18).centerYEqualToView(self.contentView).widthIs(18).heightIs(18);
    
    self.imageViewArrow.sd_layout.rightSpaceToView(self.contentView, 18).centerYEqualToView(self.contentView).widthIs(15).heightIs(15);
    
    
    self.labelTitle.sd_layout.leftSpaceToView(self.imageViewIcon, 17).rightSpaceToView(self.imageViewArrow, 17).centerYEqualToView(self.contentView).heightIs(15);
    
    
    self.line.sd_layout.leftSpaceToView(self.contentView, 18).bottomEqualToView(self.contentView).rightSpaceToView(self.contentView, 18).heightIs(0.5);
}
 
- (void)setTitle:(NSString *)title {
    _title = title;
    if (title) {
        self.labelTitle.text = title;
    }
}
 
- (UIImageView *)imageViewIcon {
    if (!_imageViewIcon) {
        _imageViewIcon = [[UIImageView alloc] init];
        _imageViewIcon.image = [UIImage imageNamed:@"search_icon"];
        
    }
    return _imageViewIcon;
}
 
- (UILabel *)labelTitle {
    if (!_labelTitle) {
        _labelTitle = [[UILabel alloc] init];
        _labelTitle.textColor = UICOLOR_FROM_RGB(0x000000, 1);
        _labelTitle.font = [UIFont systemFontOfSize:15];
        _labelTitle.textAlignment = NSTextAlignmentLeft;
    }
    return _labelTitle;
}
 
- (UIImageView *)imageViewArrow {
    if (!_imageViewArrow) {
        _imageViewArrow = [[UIImageView alloc] init];
        _imageViewArrow.image = [UIImage imageNamed:@"search_arrow"];
        
    }
    return _imageViewArrow;
}
 
- (UIView *)line {
    if (!_line) {
        _line = [[UIView alloc] init];
        _line.backgroundColor = UICOLOR_FROM_RGB(0xDFDFDF, 1);
    }
    return _line;
}
 
@end