// // HomeCollectionViewCell.m // jitao // // Created by 罗云飞 on 2017/12/20. // Copyright © 2017年 罗云飞. All rights reserved. // #import "HomeCollectionViewCell.h" @implementation HomeCollectionViewCell{ 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:(BusinessModel *)model{ //项目默认 if (model.minLogoUrl == NULL) { [incoImage setImage:NewImageNamed(@"项目默认")]; }else{ [incoImage sd_setImageWithURL:NewURL([model.minLogoUrl mosaicUrlPrefix]) placeholderImage:NewImageNamed(@"cppt")]; } name.text = model.name; } @end