Няма описание

SubmitDiscountCardCell.m 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. //
  2. // SubmitDiscountCardCell.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/6/19.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "SubmitDiscountCardCell.h"
  9. @interface SubmitDiscountCardCell ()
  10. @property (nonatomic, strong) UIView *containerView;
  11. @end
  12. @implementation SubmitDiscountCardCell
  13. @synthesize titleLabel = _titleLabel;
  14. @synthesize disCountLabel = _disCountLabel;
  15. @synthesize actionButton = _actionButton;
  16. - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
  17. {
  18. self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
  19. if (self) {
  20. [self initialize];
  21. self.selectionStyle = UITableViewCellSelectionStyleNone;
  22. }
  23. return self;
  24. }
  25. - (void)initialize{
  26. UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"coupon_body_controls_n"]];
  27. [self.contentView addSubview:self.titleLabel];
  28. [self.contentView addSubview:self.actionButton];
  29. [self.contentView addSubview:self.containerView];
  30. [self.containerView addSubview:imageView];
  31. [self.containerView addSubview:self.disCountLabel];
  32. [self.contentView addSubview:self.bottomLine];
  33. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  34. make.left.equalTo(self.contentView).offset(15);
  35. make.centerY.equalTo(self.contentView);
  36. }];
  37. [self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.right.equalTo(self.contentView).offset(- 15);
  39. make.top.equalTo(self.contentView).offset(8);
  40. make.bottom.equalTo(self.contentView).offset(- 8);
  41. make.width.equalTo(@120);
  42. }];
  43. [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
  44. make.right.equalTo(self.containerView).offset(- 5);
  45. make.centerY.equalTo(self.containerView);
  46. }];
  47. [self.disCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.centerX.equalTo(self.containerView).offset(- 10);
  49. make.centerY.equalTo(self.containerView);
  50. }];
  51. [self.actionButton mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.left.equalTo(self.containerView);
  53. make.top.bottom.right.equalTo(self.contentView);
  54. }];
  55. [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
  56. make.left.equalTo(self.titleLabel);
  57. make.bottom.right.equalTo(self.contentView);
  58. make.height.mas_equalTo(0.5);
  59. }];
  60. }
  61. //- (void)fk_configWithViewModel:(FKSubmitOrderViewModel *)viewModel indexPath:(NSIndexPath *)indexPath{
  62. // if ([viewModel isKindOfClass:[FKSubmitOrderViewModel class]]) {
  63. // NSString *discountStr = @"不使用代金券";
  64. // if (viewModel.selectedDiscount) {
  65. // discountStr = [NSString stringWithFormat:@"¥%@", [FLStringHelper convertFenToYuan:viewModel.selectedDiscount.amount]];
  66. // }
  67. // self.disCountLabel.text = discountStr;
  68. // self.bottomLine.hidden = NO;
  69. // }
  70. //}
  71. #pragma mark - getter && setter
  72. - (UILabel *)titleLabel
  73. {
  74. if (_titleLabel == nil) {
  75. _titleLabel = [[UILabel alloc]init];
  76. _titleLabel.backgroundColor = [UIColor clearColor];
  77. _titleLabel.font = [UIFont systemFontOfSize:14];
  78. _titleLabel.textColor = UIColorFromRGB(0x333333);
  79. _titleLabel.text = @"代金券";
  80. }
  81. return _titleLabel;
  82. }
  83. - (UILabel *)disCountLabel
  84. {
  85. if (_disCountLabel == nil) {
  86. _disCountLabel = [[UILabel alloc]init];
  87. _disCountLabel.textColor = UIColorFromRGB(0x999999);
  88. _disCountLabel.font = [UIFont systemFontOfSize:14];
  89. _disCountLabel.numberOfLines = 1;
  90. _disCountLabel.text = @"不使用代金券";
  91. }
  92. return _disCountLabel;
  93. }
  94. - (UIButton *)actionButton
  95. {
  96. if (_actionButton == nil) {
  97. _actionButton = [UIButton buttonWithType:UIButtonTypeCustom];
  98. }
  99. return _actionButton;
  100. }
  101. - (UIView *)containerView
  102. {
  103. if (_containerView == nil) {
  104. _containerView = [[UIView alloc]init];
  105. _containerView.backgroundColor = [UIColor colorWithRed:233.0f/255 green:234.0f/255 blue:235.0f/255 alpha:1.0f];
  106. ;
  107. _containerView.userInteractionEnabled = NO;
  108. }
  109. return _containerView;
  110. }
  111. - (UIView *)bottomLine{
  112. if (_bottomLine == nil) {
  113. _bottomLine = [[UIView alloc]init];
  114. _bottomLine.backgroundColor = UIColorFromRGB(0xe5e5e5);
  115. _bottomLine.hidden = YES;
  116. }
  117. return _bottomLine;
  118. }
  119. @end