| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //
- // AssetsCollectionViewCell.m
- // jitao
- //
- // Created by 罗云飞 on 2018/2/6.
- // Copyright © 2018年 罗云飞. All rights reserved.
- //
- #import "AssetsCollectionViewCell.h"
- @implementation AssetsCollectionViewCell{
- UIImageView *incoImage;
- UILabel *name;//名称
- }
- - (id)initWithFrame:(CGRect)frame
- {
- self = [super initWithFrame:frame];
- if (self) {
- incoImage = [UIImageView new];
- [self.contentView addSubview:incoImage];
- CGFloat proportion = (CGFloat)210/335;//图片宽高比
-
- incoImage.sd_layout
- .leftSpaceToView(self.contentView, 0)
- .rightSpaceToView(self.contentView, 0)
- .topSpaceToView(self.contentView, 0)
- .autoHeightRatio(proportion);
-
- name = [UILabel new];
- name.font = NewFont(fitScreenWidth(13));
- name.textColor = NewBlackColor;
- name.textAlignment = NSTextAlignmentCenter;
- [self.contentView addSubview:name];
-
- name.sd_layout
- .leftEqualToView(incoImage)
- .heightIs(15)
- .topSpaceToView(incoImage, 5)
- .widthIs(SCREEN_WIDTH/2-15-5);
- }
- return self;
- }
- - (void)assignment:(KnowledgeproductionModel *)model{
- //项目默认
- if (model.img == NULL) {
- [incoImage setImage:NewImageNamed(@"项目默认")];
- }else{
- [incoImage sd_setImageWithURL:NewURL([model.img mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"cppt")];
- }
- name.text = model.name;
- }
- @end
|