Açıklama Yok

FKProSeekCell.m 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //
  2. // FKProSeekCell.m
  3. // FirstLink
  4. //
  5. // Created by jack on 16/8/13.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKProSeekCell.h"
  9. #import "FKProDetailViewModel.h"
  10. @interface FKProSeekCell ()
  11. @property (nonatomic, strong) UILabel *leftLabel;
  12. @property (nonatomic, strong) UILabel *askLabel;
  13. @property (nonatomic, strong) UIImageView *rightArrow;
  14. @end
  15. @implementation FKProSeekCell
  16. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
  17. if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
  18. [self addAllSubviews];
  19. self.contentView.backgroundColor = [UIColor whiteColor];
  20. self.selectionStyle = UITableViewCellSelectionStyleNone;
  21. }
  22. return self;
  23. }
  24. - (void)addAllSubviews{
  25. [self.contentView addSubview:self.leftLabel];
  26. [self.contentView addSubview:self.askLabel];
  27. [self.contentView addSubview:self.rightArrow];
  28. [self.leftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.equalTo(self.contentView).offset(15);
  30. make.centerY.equalTo(self.contentView);
  31. }];
  32. [self.rightArrow mas_makeConstraints:^(MASConstraintMaker *make) {
  33. make.right.equalTo(self.contentView).offset(- 15);
  34. make.centerY.equalTo(self.contentView);
  35. // make.width.mas_equalTo(10.5);
  36. }];
  37. [self.askLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.left.equalTo(self.leftLabel.mas_right);
  39. make.right.equalTo(self.rightArrow.mas_left).offset(- 15);
  40. make.centerY.equalTo(self.contentView);
  41. }];
  42. }
  43. + (CGFloat)cellHeight{
  44. return 44.0f;
  45. }
  46. - (void)fk_configWithViewModel:(id)viewModel indexPath:(NSIndexPath *)indexPath{
  47. if ([viewModel isKindOfClass:[FKProDetailViewModel class]]) {
  48. self.askLabel.text = @"对商品有疑问? 可以在这里问问看";
  49. }
  50. }
  51. #pragma mark - property
  52. - (UILabel *)leftLabel{
  53. if (_leftLabel == nil) {
  54. _leftLabel = [[UILabel alloc]init];
  55. _leftLabel.textColor = UIColorFromRGB(0x333333);
  56. _leftLabel.font = [UIFont systemFontOfSize:14];
  57. _leftLabel.text = @"购买咨询:";
  58. [_leftLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  59. [_leftLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  60. }
  61. return _leftLabel;
  62. }
  63. - (UILabel *)askLabel{
  64. if (_askLabel == nil) {
  65. _askLabel = [[UILabel alloc]init];
  66. _askLabel.font = [UIFont systemFontOfSize:13];
  67. _askLabel.textColor = UIColorFromRGB(0x999999);
  68. _askLabel.textAlignment = NSTextAlignmentRight;
  69. _askLabel.lineBreakMode = NSLineBreakByTruncatingTail;
  70. _askLabel.text = @"对商品有疑问? 问问已经购买的用户吧";
  71. }
  72. return _askLabel;
  73. }
  74. - (UIImageView *)rightArrow{
  75. if (_rightArrow == nil) {
  76. _rightArrow = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"more_right_arrow"]];
  77. [_rightArrow setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  78. [_rightArrow setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
  79. }
  80. return _rightArrow;
  81. }
  82. @end