//
|
// 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
|