123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- //
- // SubmitDiscountCardCell.m
- // FirstLink
- //
- // Created by jack on 15/6/19.
- // Copyright (c) 2015年 FirstLink. All rights reserved.
- //
- #import "SubmitDiscountCardCell.h"
- @interface SubmitDiscountCardCell ()
- @property (nonatomic, strong) UIView *containerView;
- @end
- @implementation SubmitDiscountCardCell
- @synthesize titleLabel = _titleLabel;
- @synthesize disCountLabel = _disCountLabel;
- @synthesize actionButton = _actionButton;
- - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
- {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- if (self) {
- [self initialize];
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- }
- return self;
- }
- - (void)initialize{
-
- UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"coupon_body_controls_n"]];
-
- [self.contentView addSubview:self.titleLabel];
- [self.contentView addSubview:self.actionButton];
- [self.contentView addSubview:self.containerView];
- [self.containerView addSubview:imageView];
- [self.containerView addSubview:self.disCountLabel];
- [self.contentView addSubview:self.bottomLine];
-
- [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.contentView).offset(15);
- make.centerY.equalTo(self.contentView);
- }];
-
- [self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.contentView).offset(- 15);
- make.top.equalTo(self.contentView).offset(8);
- make.bottom.equalTo(self.contentView).offset(- 8);
- make.width.equalTo(@120);
- }];
-
- [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.right.equalTo(self.containerView).offset(- 5);
- make.centerY.equalTo(self.containerView);
- }];
-
- [self.disCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
- make.centerX.equalTo(self.containerView).offset(- 10);
- make.centerY.equalTo(self.containerView);
- }];
-
- [self.actionButton mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.containerView);
- make.top.bottom.right.equalTo(self.contentView);
- }];
-
- [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
- make.left.equalTo(self.titleLabel);
- make.bottom.right.equalTo(self.contentView);
- make.height.mas_equalTo(0.5);
- }];
- }
- //- (void)fk_configWithViewModel:(FKSubmitOrderViewModel *)viewModel indexPath:(NSIndexPath *)indexPath{
- // if ([viewModel isKindOfClass:[FKSubmitOrderViewModel class]]) {
- // NSString *discountStr = @"不使用代金券";
- // if (viewModel.selectedDiscount) {
- // discountStr = [NSString stringWithFormat:@"¥%@", [FLStringHelper convertFenToYuan:viewModel.selectedDiscount.amount]];
- // }
- // self.disCountLabel.text = discountStr;
- // self.bottomLine.hidden = NO;
- // }
- //}
- #pragma mark - getter && setter
- - (UILabel *)titleLabel
- {
- if (_titleLabel == nil) {
- _titleLabel = [[UILabel alloc]init];
- _titleLabel.backgroundColor = [UIColor clearColor];
- _titleLabel.font = [UIFont systemFontOfSize:14];
- _titleLabel.textColor = UIColorFromRGB(0x333333);
- _titleLabel.text = @"代金券";
- }
- return _titleLabel;
- }
- - (UILabel *)disCountLabel
- {
- if (_disCountLabel == nil) {
- _disCountLabel = [[UILabel alloc]init];
- _disCountLabel.textColor = UIColorFromRGB(0x999999);
- _disCountLabel.font = [UIFont systemFontOfSize:14];
- _disCountLabel.numberOfLines = 1;
- _disCountLabel.text = @"不使用代金券";
- }
- return _disCountLabel;
- }
- - (UIButton *)actionButton
- {
- if (_actionButton == nil) {
- _actionButton = [UIButton buttonWithType:UIButtonTypeCustom];
- }
- return _actionButton;
- }
- - (UIView *)containerView
- {
- if (_containerView == nil) {
- _containerView = [[UIView alloc]init];
- _containerView.backgroundColor = [UIColor colorWithRed:233.0f/255 green:234.0f/255 blue:235.0f/255 alpha:1.0f];
- ;
- _containerView.userInteractionEnabled = NO;
- }
- return _containerView;
- }
- - (UIView *)bottomLine{
- if (_bottomLine == nil) {
- _bottomLine = [[UIView alloc]init];
- _bottomLine.backgroundColor = UIColorFromRGB(0xe5e5e5);
- _bottomLine.hidden = YES;
- }
- return _bottomLine;
- }
- @end
|