// // SubmitBottomView.m // FirstLink // // Created by jack on 15/6/18. // Copyright (c) 2015年 FirstLink. All rights reserved. // #import "SubmitBottomView.h" @implementation SubmitBottomView @synthesize priceLabel = _priceLabel; @synthesize confirmBtn = _confirmBtn; - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { [self initialize]; } return self; } - (void)initialize { self.backgroundColor = UIColorFromRGB(0xf8f8f8); [self addSubview:self.priceLabel]; [self addSubview:self.confirmBtn]; [self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.top.right.bottom.equalTo(self); make.width.equalTo(@135); }]; [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(self).offset(15); make.centerY.equalTo(self); }]; } - (void)refreshPriceWithAmount:(long)amount totalFee:(CGFloat)totalFee{ NSString *feeString = [NSString stringWithFormat:@"¥%.2f", totalFee]; NSString *headStr = [NSString stringWithFormat:@"共%ld件, 合计:", amount]; NSString *string = [NSString stringWithFormat:@"%@%@", headStr, feeString]; NSMutableAttributedString *attM = [[NSMutableAttributedString alloc]initWithString:string]; [attM addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0xff6362) range:NSMakeRange(headStr.length, feeString.length)]; [attM addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:NSMakeRange(headStr.length, feeString.length)]; self.priceLabel.attributedText = attM; } #pragma mark - getter && setter - (UILabel *)priceLabel { if (_priceLabel == nil) { _priceLabel = [[UILabel alloc]init]; _priceLabel.textColor = UIColorFromRGB(0x333333); _priceLabel.font = [UIFont systemFontOfSize:14]; } return _priceLabel; } - (UIButton *)confirmBtn { if (_confirmBtn == nil) { _confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom]; _confirmBtn.titleLabel.font = [UIFont systemFontOfSize:16]; [_confirmBtn setTitle:@"提 交" forState:UIControlStateNormal]; [_confirmBtn setTitleColor:UIColorFromRGB(0xffffff) forState:UIControlStateNormal]; [_confirmBtn setBackgroundColor:UIColorFromRGB(0xff6362)]; } return _confirmBtn; } @end