123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- //
- // FKCirDetailLinkCell.m
- // FirstLink
- //
- // Created by jack on 16/6/15.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKCirDetailLinkCell.h"
- #import "FKCircleDetailViewModel.h"
- #define PRO_IMAGE_MARGIN 53
- @interface FKCirDetailLinkCell ()
- @property (nonatomic, strong) UIView *proCotainerView;
- @property (nonatomic, strong) UIImageView *proImgView;
- @property (nonatomic, strong) UIImageView *rightArrow;
- @property (nonatomic, strong) UILabel *titleLabel;
- @property (nonatomic, strong) UILabel *priceLabel;
- @property (nonatomic, strong) UILabel *siteLabel;
- @end
- @implementation FKCirDetailLinkCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
-
- [self addAllSubviews];
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.contentView.backgroundColor = [UIColor whiteColor];
- }
- return self;
- }
- - (void)addAllSubviews{
-
- [self.contentView addSubview:self.proCotainerView];
-
- [self.proCotainerView addSubview:self.proImgView];
- [self.proCotainerView addSubview:self.titleLabel];
- [self.proCotainerView addSubview:self.priceLabel];
- [self.proCotainerView addSubview:self.siteLabel];
- [self.proCotainerView addSubview:self.rightArrow];
-
- [self.proCotainerView mas_makeConstraints:^(MASConstraintMaker *make) {
- // make.top.equalTo(self.contentView).offset(10);
- make.centerY.equalTo(self.contentView);
- make.left.equalTo(self.contentView).offset(15);
- make.right.equalTo(self.contentView).offset(- 15);
- make.height.mas_equalTo(79);
- }];
-
- [self.proImgView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.proCotainerView).offset(6);
- make.centerY.equalTo(self.proCotainerView);
- make.width.height.mas_equalTo(PRO_IMAGE_MARGIN);
- }];
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.proImgView.mas_right).offset(8);
- make.right.equalTo(self.proCotainerView).offset(- 15);
- make.top.equalTo(self.proImgView);
- }];
-
- [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.titleLabel);
- make.bottom.equalTo(self.proImgView).offset(- 8);
- }];
-
- [self.siteLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.priceLabel.mas_right).offset(18);
- make.baseline.equalTo(self.priceLabel);
- }];
-
- [self.rightArrow mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.proCotainerView).offset(- 9);
- make.centerY.equalTo(self.proCotainerView);
- }];
- }
- + (CGFloat)cellHeight{
- return 89;
- }
- - (void)fk_configWithViewModel:(id)viewModel indexPath:(NSIndexPath *)indexPath{
- if ([viewModel isKindOfClass:[FKCircleDetailViewModel class]]) {
- FKCircleDetailViewModel *cirViewModel = (FKCircleDetailViewModel *)viewModel;
- FKCirDetailContentItem *contentItem = [cirViewModel.dataItem contentDetailItemForIndex:indexPath.row];
- if (contentItem.contentData.productItem){
-
- [self.proImgView setImageWithURL:contentItem.contentData.productItem.firstPicUrl
- placeholderImage:nil
- width:PRO_IMAGE_MARGIN
- height:PRO_IMAGE_MARGIN];
-
- self.titleLabel.text = contentItem.contentData.productItem.name;
- self.priceLabel.text = [FLStringHelper convertFenToRMBmoneyString:contentItem.contentData.productItem.price];
- self.siteLabel.text = contentItem.contentData.supplyItem.name;
- }
- }
- }
- #pragma mark - property
- - (UIView *)proCotainerView{
- if (_proCotainerView == nil) {
- _proCotainerView = [[UIView alloc]init];
- _proCotainerView.backgroundColor = UIColorFromRGB(0xf1f1f1);
- _proCotainerView.layer.cornerRadius = 2.5;
- }
- return _proCotainerView;
- }
- - (UIImageView *)proImgView{
- if (_proImgView == nil) {
- _proImgView = [[UIImageView alloc]init];
- _proImgView.contentMode = UIViewContentModeScaleAspectFit;
- }
- return _proImgView;
- }
- - (UIImageView *)rightArrow{
- if (_rightArrow == nil) {
- _rightArrow = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"rightArrow_more"]];
- }
- return _rightArrow;
- }
- - (UILabel *)titleLabel{
- if (_titleLabel == nil) {
- _titleLabel = [[UILabel alloc]init];
- _titleLabel.textColor = UIColorFromRGB(0x262626);
- _titleLabel.font = [UIFont systemFontOfSize:14];
- }
- return _titleLabel;
- }
- - (UILabel *)priceLabel{
- if (_priceLabel == nil) {
- _priceLabel = [[UILabel alloc]init];
- _priceLabel.textColor = UIColorFromRGB(0xff6362);
- _priceLabel.font = [UIFont systemFontOfSize:14];
- }
- return _priceLabel;
- }
- - (UILabel *)siteLabel{
- if (_siteLabel == nil) {
- _siteLabel = [[UILabel alloc]init];
- _siteLabel.textColor = UIColorFromRGB(0x9b9b9b);
- _siteLabel.font = [UIFont systemFontOfSize:12];
- }
- return _siteLabel;
- }
- @end
|