12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- //
- // ZBProductClassListCell.m
- // ZBProject
- //
- // Created by 学丽 on 2019/4/15.
- // Copyright © 2019 ZB. All rights reserved.
- //
- #import "ZBProductClassListCell.h"
- @implementation ZBProductClassListCell
- -(instancetype)initWithFrame:(CGRect)frame
- {
- self=[super initWithFrame:frame];
- if (self) {
- [self addSubview:self.imageView];
- [self addSubview:self.label];
-
- [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.mas_equalTo(self.mas_centerX);
- make.top.mas_equalTo(13);
- make.width.height.mas_equalTo(48);
- }];
-
- [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(self.imageView.mas_bottom).mas_offset(3);
- make.left.right.mas_equalTo(0);
- make.height.mas_equalTo(15);
- }];
- }
- return self;
- }
- -(void)setModel:(ClassModel *)model
- {
- _model = model;
- [self.imageView sd_setImageWithURL:[NSURL URLWithString:model.icon]];
- self.label.text=model.name;
- }
- - (UIImageView *)imageView {
- if (!_imageView) {
- _imageView = [[UIImageView alloc] init];
- _imageView.layer.cornerRadius = Fitsize(4);
- _imageView.layer.masksToBounds = YES;
-
- _imageView.image = [UIImage imageNamed:@"category"];
- }
- return _imageView;
- }
- - (UILabel *)label {
- if (!_label) {
- _label = [[UILabel alloc] init];
- _label.textAlignment = NSTextAlignmentCenter;
- _label.font = [UIFont systemFontOfSize:12];
- _label.textColor = [UIColor YHColorWithHex:0x444444];
- _label.text = @"人气榜单";
- }
- return _label;
- }
- @end
|