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
//
//  PPTVPopCell.m
//  BuWanVideo2.0
//
//  Created by Aeline on 2021/5/15.
//  Copyright © 2021 com.yeshi.buwansheque.ios. All rights reserved.
//
 
#import "PPTVPopCell.h"
 
@interface PPTVPopCell ()
 
@property (nonatomic, nullable, strong) UIImageView *imageViewIcon;
@property (nonatomic, nullable, strong) UILabel *labelTitle;
 
@end
 
@implementation PPTVPopCell
 
- (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.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor whiteColor];
        [self setupViewConfig];
    }
    return self;
}
 
- (void)setupViewConfig {
  
    [self.contentView addSubview:self.imageViewIcon];
    self.imageViewIcon.sd_layout.leftSpaceToView(self.contentView, 17).centerYEqualToView(self.contentView).widthIs(17).heightIs(17);
    
    [self.contentView addSubview:self.labelTitle];
    self.labelTitle.sd_layout.leftSpaceToView(self.imageViewIcon, 9).centerYEqualToView(self.imageViewIcon).rightSpaceToView(self.contentView, 0).heightIs(20);
}
 
- (void)setIndex:(NSInteger)index {
    _index = index;
}
 
- (void)setData:(NSDictionary *)data {
    if (data) {
        
        if (_index == 0) {
            self.imageViewIcon.sd_resetLayout.leftSpaceToView(self.contentView, 17).bottomSpaceToView(self.contentView, 6).widthIs(17).heightIs(17);
            
        } else  if (_index == 1) {
            self.imageViewIcon.sd_resetLayout.leftSpaceToView(self.contentView, 17).centerYEqualToView(self.contentView).widthIs(17).heightIs(17);
            
        } else  if (_index == 2) {
            self.imageViewIcon.sd_resetLayout.leftSpaceToView(self.contentView, 17).topSpaceToView(self.contentView, 6).widthIs(17).heightIs(17);
        }
        
        self.imageViewIcon.image = [UIImage imageNamed:data[@"icon"]];
        self.labelTitle.text = data[@"name"];
    }
}
 
- (UIImageView *)imageViewIcon {
    if (!_imageViewIcon) {
        _imageViewIcon = [[UIImageView alloc] init];
    }
    return _imageViewIcon;;
}
 
- (UILabel *)labelTitle {
    if (!_labelTitle) {
        _labelTitle = [[UILabel alloc] init];
        _labelTitle.font = [UIFont systemFontOfSize:15];
        _labelTitle.textColor =UIColorFromRGBValue(0x666666);
        _labelTitle.textAlignment = NSTextAlignmentLeft;
    }
    return _labelTitle;
}
 
@end