You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.8 KiB
64 lines
1.8 KiB
4 years ago
|
//
|
||
|
// TFMemberPrivilegeItemCell.m
|
||
|
// TFReader
|
||
|
//
|
||
|
// Created by 谢腾飞 on 2020/12/13.
|
||
|
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "TFMemberPrivilegeItemCell.h"
|
||
|
|
||
|
@interface TFMemberPrivilegeItemCell ()
|
||
|
{
|
||
|
UIImageView *privilegeIcon;
|
||
|
UILabel *privilegeLabel;
|
||
|
}
|
||
|
@end
|
||
|
|
||
|
@implementation TFMemberPrivilegeItemCell
|
||
|
|
||
|
- (instancetype)initWithFrame:(CGRect)frame
|
||
|
{
|
||
|
if (self = [super initWithFrame:frame]) {
|
||
|
[self createSubviews];
|
||
|
}
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (void)createSubviews
|
||
|
{
|
||
|
privilegeIcon = [[UIImageView alloc] init];
|
||
|
[self addSubview:privilegeIcon];
|
||
|
|
||
|
[privilegeIcon mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.centerX.mas_equalTo(self.mas_centerX);
|
||
|
make.top.mas_equalTo(self.mas_top);
|
||
|
make.width.height.mas_equalTo(self.mas_width).multipliedBy(0.5);
|
||
|
}];
|
||
|
|
||
|
privilegeLabel = [[UILabel alloc] init];
|
||
|
privilegeLabel.textAlignment = NSTextAlignmentCenter;
|
||
|
privilegeLabel.textColor = kBlackColor;
|
||
|
privilegeLabel.font = kMainFont;
|
||
|
[self addSubview:privilegeLabel];
|
||
|
|
||
|
[privilegeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.mas_equalTo(self.mas_left).with.offset(kQuarterMargin);
|
||
|
make.top.mas_equalTo(privilegeIcon.mas_bottom).with.offset(kHalfMargin + kQuarterMargin);
|
||
|
make.right.mas_equalTo(self.mas_right).with.offset(- kQuarterMargin);
|
||
|
make.height.mas_equalTo(20);
|
||
|
}];
|
||
|
}
|
||
|
|
||
|
- (void)setPrivilegeModel:(TFPrivilegeModel *)privilegeModel
|
||
|
{
|
||
|
_privilegeModel = privilegeModel;
|
||
|
|
||
|
[privilegeIcon setImageWithURL:[NSURL URLWithString:privilegeModel.icon] placeholder:HoldImage options:YYWebImageOptionSetImageWithFadeAnimation completion:nil];
|
||
|
|
||
|
privilegeLabel.text = privilegeModel.label?:@"";
|
||
|
}
|
||
|
|
||
|
|
||
|
@end
|