Keine Beschreibung

SubmitBottomView.m 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // SubmitBottomView.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/6/18.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "SubmitBottomView.h"
  9. @implementation SubmitBottomView
  10. @synthesize priceLabel = _priceLabel;
  11. @synthesize confirmBtn = _confirmBtn;
  12. - (instancetype)initWithFrame:(CGRect)frame
  13. {
  14. if (self = [super initWithFrame:frame]) {
  15. [self initialize];
  16. }
  17. return self;
  18. }
  19. - (void)initialize
  20. {
  21. self.backgroundColor = UIColorFromRGB(0xf8f8f8);
  22. [self addSubview:self.priceLabel];
  23. [self addSubview:self.confirmBtn];
  24. [self.confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  25. make.top.right.bottom.equalTo(self);
  26. make.width.equalTo(@135);
  27. }];
  28. [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  29. make.left.equalTo(self).offset(15);
  30. make.centerY.equalTo(self);
  31. }];
  32. }
  33. - (void)refreshPriceWithAmount:(long)amount totalFee:(CGFloat)totalFee{
  34. NSString *feeString = [NSString stringWithFormat:@"¥%.2f", totalFee];
  35. NSString *headStr = [NSString stringWithFormat:@"共%ld件, 合计:", amount];
  36. NSString *string = [NSString stringWithFormat:@"%@%@", headStr, feeString];
  37. NSMutableAttributedString *attM = [[NSMutableAttributedString alloc]initWithString:string];
  38. [attM addAttribute:NSForegroundColorAttributeName value:UIColorFromRGB(0xff6362) range:NSMakeRange(headStr.length, feeString.length)];
  39. [attM addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:14] range:NSMakeRange(headStr.length, feeString.length)];
  40. self.priceLabel.attributedText = attM;
  41. }
  42. #pragma mark - getter && setter
  43. - (UILabel *)priceLabel
  44. {
  45. if (_priceLabel == nil) {
  46. _priceLabel = [[UILabel alloc]init];
  47. _priceLabel.textColor = UIColorFromRGB(0x333333);
  48. _priceLabel.font = [UIFont systemFontOfSize:14];
  49. }
  50. return _priceLabel;
  51. }
  52. - (UIButton *)confirmBtn
  53. {
  54. if (_confirmBtn == nil) {
  55. _confirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  56. _confirmBtn.titleLabel.font = [UIFont systemFontOfSize:16];
  57. [_confirmBtn setTitle:@"提 交" forState:UIControlStateNormal];
  58. [_confirmBtn setTitleColor:UIColorFromRGB(0xffffff) forState:UIControlStateNormal];
  59. [_confirmBtn setBackgroundColor:UIColorFromRGB(0xff6362)];
  60. }
  61. return _confirmBtn;
  62. }
  63. @end