// // ASMyCartNoDataView.m // Asteria // // Created by xingyu on 2024/5/23. // #import "ASMyCartNoDataView.h" @interface ASMyCartNoDataView() @property (nonatomic, strong) UIView *emptyV; @property (nonatomic, strong) UIImageView *emptyImageView; @end @implementation ASMyCartNoDataView - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { [self addSubview:self.emptyV]; [self.emptyV mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.mas_equalTo(0); }]; _emptyImageView = [[UIImageView alloc] init]; _emptyImageView.contentMode = UIViewContentModeScaleAspectFit; _emptyImageView.image = [UIImage imageNamed:@"cart_no_data"]; [self.emptyV addSubview:_emptyImageView]; [_emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.emptyV); make.top.mas_equalTo(60); make.width.height.mas_equalTo(KScreenWidth - 80); }]; K_WEAK_SELF; dispatch_async(dispatch_get_main_queue(), ^{ K_STRONG_SELF; [UIView viewAddHorColorBg:self.emptyV colorArr:@[ (id)_E0FFF5.CGColor, (id)Col_FFF.CGColor ] startP:CGPointMake(0.5, 0.25) endP:CGPointMake(0.5, 1)]; [self.emptyV bringSubviewToFront:self.emptyImageView]; }); UIButton *clickBtn = [UIButton buttonWithType:UIButtonTypeCustom]; clickBtn.titleLabel.font = [UIFont fontWithName:Rob_Regular size:14]; [clickBtn setTitle:@"Contact Us" forState:UIControlStateNormal]; clickBtn.backgroundColor = Col_000; [clickBtn addTarget:self action:@selector(_btnClick) forControlEvents:UIControlEventTouchUpInside]; TT_ViewRadius(clickBtn, 4); [clickBtn setTitleColor:Col_FFF forState:UIControlStateNormal]; [self addSubview:clickBtn]; [clickBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(_emptyImageView.mas_bottom).offset(48); make.height.mas_equalTo(45); make.left.mas_equalTo(40); make.right.mas_equalTo(-40); }]; } return self; } - (void)_btnClick { } - (UIView *)emptyV { if (!_emptyV) { UIView *v = [UIView baseV]; v.backgroundColor = Col_FFF; _emptyV = v; } return _emptyV; } @end