|
@@ -9,49 +9,69 @@
|
|
|
|
|
|
@implementation ASCheckoutTopView
|
|
|
|
|
|
-- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
- if (self = [super initWithFrame:frame]) {
|
|
|
- self.backgroundColor = ThemeLightColor;
|
|
|
-
|
|
|
+- (UILabel *)countLab {
|
|
|
+ if (!_countLab) {
|
|
|
_countLab = [[UILabel alloc] init];
|
|
|
_countLab.textColor = _0B0B0B;
|
|
|
_countLab.text = @"show order items";
|
|
|
_countLab.font = [UIFont fontWithName:Rob_Bold size:16];
|
|
|
- [self addSubview:_countLab];
|
|
|
- [_countLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.left.mas_equalTo(20);
|
|
|
- make.centerY.equalTo(self);
|
|
|
- }];
|
|
|
-
|
|
|
+ }
|
|
|
+ return _countLab;
|
|
|
+}
|
|
|
+
|
|
|
+- (UIButton *)arrowBtn {
|
|
|
+ if (!_arrowBtn) {
|
|
|
_arrowBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
[_arrowBtn setImage:[UIImage imageNamed:@"checkout_arrow_up"] forState:UIControlStateNormal];
|
|
|
[_arrowBtn setImage:[UIImage imageNamed:@"checkout_arrow_down"] forState:UIControlStateSelected];
|
|
|
_arrowBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:12];
|
|
|
[_arrowBtn addTarget:self action:@selector(_isFlodClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
[_arrowBtn setTitleColor:_0B0B0B forState:0];
|
|
|
- [self addSubview:_arrowBtn];
|
|
|
- [_arrowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ }
|
|
|
+ return _arrowBtn;
|
|
|
+}
|
|
|
+
|
|
|
+- (UILabel *)priceLab {
|
|
|
+ if (!_priceLab) {
|
|
|
+ _priceLab = [[UILabel alloc] init];
|
|
|
+ _priceLab.textColor = _0B0B0B;
|
|
|
+ _priceLab.font = [UIFont fontWithName:Rob_Bold size:16];
|
|
|
+ }
|
|
|
+ return _priceLab;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (instancetype)initWithFrame:(CGRect)frame {
|
|
|
+ if (self = [super initWithFrame:frame]) {
|
|
|
+ self.backgroundColor = ThemeLightColor;
|
|
|
+
|
|
|
+ [self addSubview:self.countLab];
|
|
|
+ [self addSubview:self.arrowBtn];
|
|
|
+ [self addSubview:self.priceLab];
|
|
|
+
|
|
|
+ [self.countLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.left.mas_equalTo(20);
|
|
|
+ make.centerY.equalTo(self);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.arrowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
make.right.mas_equalTo(-12);
|
|
|
make.centerY.equalTo(self);
|
|
|
make.width.mas_equalTo(35);
|
|
|
make.height.mas_equalTo(32);
|
|
|
}];
|
|
|
|
|
|
- _priceLab = [[UILabel alloc] init];
|
|
|
- _priceLab.textColor = _0B0B0B;
|
|
|
- _priceLab.font = [UIFont fontWithName:Rob_Bold size:16];
|
|
|
- [self addSubview:_priceLab];
|
|
|
- [_priceLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.right.equalTo(_arrowBtn.mas_left).offset(-6);
|
|
|
+ [self.priceLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.right.equalTo(self.arrowBtn.mas_left).offset(-6);
|
|
|
make.centerY.equalTo(self);
|
|
|
}];
|
|
|
}
|
|
|
return self;
|
|
|
}
|
|
|
- (void)setTopViewData:(NSString *)itemCount price:(NSString *)priceStr {
|
|
|
- _countLab.text = [NSString stringWithFormat:@"show order items (%@)", AS_String_valid(itemCount) ? AS_String_NotNull(itemCount) : @"0"];
|
|
|
+ self.countLab.text = [NSString stringWithFormat:@"show order items (%@)", AS_String_valid(itemCount) ? AS_String_NotNull(itemCount) : @"0"];
|
|
|
|
|
|
- _priceLab.text = priceStr;
|
|
|
+ self.priceLab.text = priceStr;
|
|
|
}
|
|
|
|
|
|
- (void)_isFlodClick:(UIButton *)button {
|