ASMyCartNoDataView.m 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // ASMyCartNoDataView.m
  3. // Asteria
  4. //
  5. // Created by xingyu on 2024/5/23.
  6. //
  7. #import "ASMyCartNoDataView.h"
  8. @interface ASMyCartNoDataView()
  9. @property (nonatomic, strong) UIView *emptyV;
  10. @property (nonatomic, strong) UIImageView *emptyImageView;
  11. @end
  12. @implementation ASMyCartNoDataView
  13. - (instancetype)initWithFrame:(CGRect)frame {
  14. if (self = [super initWithFrame:frame]) {
  15. [self addSubview:self.emptyV];
  16. [self.emptyV mas_makeConstraints:^(MASConstraintMaker *make) {
  17. make.edges.mas_equalTo(0);
  18. }];
  19. _emptyImageView = [[UIImageView alloc] init];
  20. _emptyImageView.contentMode = UIViewContentModeScaleAspectFit;
  21. _emptyImageView.image = [UIImage imageNamed:@"cart_no_data"];
  22. [self.emptyV addSubview:_emptyImageView];
  23. [_emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.centerX.equalTo(self.emptyV);
  25. make.top.mas_equalTo(60);
  26. make.width.height.mas_equalTo(KScreenWidth - 80);
  27. }];
  28. K_WEAK_SELF;
  29. dispatch_async(dispatch_get_main_queue(), ^{
  30. K_STRONG_SELF;
  31. [UIView viewAddHorColorBg:self.emptyV colorArr:@[
  32. (id)_E0FFF5.CGColor,
  33. (id)Col_FFF.CGColor
  34. ] startP:CGPointMake(0.5, 0.25) endP:CGPointMake(0.5, 1)];
  35. [self.emptyV bringSubviewToFront:self.emptyImageView];
  36. });
  37. UIButton *clickBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  38. clickBtn.titleLabel.font = [UIFont fontWithName:Rob_Regular size:14];
  39. [clickBtn setTitle:@"Contact Us" forState:UIControlStateNormal];
  40. clickBtn.backgroundColor = Col_000;
  41. [clickBtn addTarget:self action:@selector(_btnClick) forControlEvents:UIControlEventTouchUpInside];
  42. TT_ViewRadius(clickBtn, 4);
  43. [clickBtn setTitleColor:Col_FFF forState:UIControlStateNormal];
  44. [self addSubview:clickBtn];
  45. [clickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.top.mas_equalTo(_emptyImageView.mas_bottom).offset(48);
  47. make.height.mas_equalTo(45);
  48. make.left.mas_equalTo(40);
  49. make.right.mas_equalTo(-40);
  50. }];
  51. }
  52. return self;
  53. }
  54. - (void)_btnClick {
  55. }
  56. - (UIView *)emptyV {
  57. if (!_emptyV) {
  58. UIView *v = [UIView baseV];
  59. v.backgroundColor = Col_FFF;
  60. _emptyV = v;
  61. }
  62. return _emptyV;
  63. }
  64. @end