123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- //
- // FKProSeekCell.m
- // FirstLink
- //
- // Created by jack on 16/8/13.
- // Copyright © 2016年 FirstLink. All rights reserved.
- //
- #import "FKProSeekCell.h"
- #import "FKProDetailViewModel.h"
- @interface FKProSeekCell ()
- @property (nonatomic, strong) UILabel *leftLabel;
- @property (nonatomic, strong) UILabel *askLabel;
- @property (nonatomic, strong) UIImageView *rightArrow;
- @end
- @implementation FKProSeekCell
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
-
- [self addAllSubviews];
-
- self.contentView.backgroundColor = [UIColor whiteColor];
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return self;
- }
- - (void)addAllSubviews{
-
- [self.contentView addSubview:self.leftLabel];
- [self.contentView addSubview:self.askLabel];
- [self.contentView addSubview:self.rightArrow];
-
- [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.contentView).offset(15);
- make.centerY.equalTo(self.contentView);
- }];
-
- [self.rightArrow mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.contentView).offset(- 15);
- make.centerY.equalTo(self.contentView);
- // make.width.mas_equalTo(10.5);
- }];
-
- [self.askLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.leftLabel.mas_right);
- make.right.equalTo(self.rightArrow.mas_left).offset(- 15);
- make.centerY.equalTo(self.contentView);
- }];
- }
- + (CGFloat)cellHeight{
- return 44.0f;
- }
- - (void)fk_configWithViewModel:(id)viewModel indexPath:(NSIndexPath *)indexPath{
- if ([viewModel isKindOfClass:[FKProDetailViewModel class]]) {
- self.askLabel.text = @"对商品有疑问? 可以在这里问问看";
- }
- }
- #pragma mark - property
- - (UILabel *)leftLabel{
- if (_leftLabel == nil) {
- _leftLabel = [[UILabel alloc]init];
- _leftLabel.textColor = UIColorFromRGB(0x333333);
- _leftLabel.font = [UIFont systemFontOfSize:14];
- _leftLabel.text = @"购买咨询:";
- [_leftLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
- [_leftLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
- }
- return _leftLabel;
- }
- - (UILabel *)askLabel{
- if (_askLabel == nil) {
- _askLabel = [[UILabel alloc]init];
- _askLabel.font = [UIFont systemFontOfSize:13];
- _askLabel.textColor = UIColorFromRGB(0x999999);
- _askLabel.textAlignment = NSTextAlignmentRight;
- _askLabel.lineBreakMode = NSLineBreakByTruncatingTail;
- _askLabel.text = @"对商品有疑问? 问问已经购买的用户吧";
- }
- return _askLabel;
- }
- - (UIImageView *)rightArrow{
- if (_rightArrow == nil) {
- _rightArrow = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"more_right_arrow"]];
- [_rightArrow setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
- [_rightArrow setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
- }
- return _rightArrow;
- }
- @end
|