GoodsDetailsBottomV.m 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // GoodsDetailsBottomV.m
  3. // Asteria
  4. //
  5. // Created by 王猛 on 2023/12/27.
  6. //
  7. #import "GoodsDetailsBottomV.h"
  8. @interface GoodsDetailsBottomV ()
  9. @property (nonatomic, strong) QMUIButton *shopBtn;
  10. @property (nonatomic, strong) QMUIButton *addCartBtn;
  11. @end
  12. @implementation GoodsDetailsBottomV
  13. - (void)tt_setupViews{
  14. UIView *lineV = [[UIView alloc]init];
  15. lineV.backgroundColor = [UIColor colorWithHexString:@"#666666"];
  16. lineV.frame = CGRectMake(0, 0, KScreenWidth, 0.5);
  17. [self addSubview:lineV];
  18. [self addSubview:self.shopBtn];
  19. [self addSubview:self.addCartBtn];
  20. [self btnSetCornRious];
  21. }
  22. -(void)btnSetCornRious{
  23. UIBezierPath* rounded = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, self.shopBtn.mj_w, self.shopBtn.mj_h) byRoundingCorners: UIRectCornerTopLeft | UIRectCornerBottomLeft cornerRadii:CGSizeMake(4, 4)];
  24. CAShapeLayer* shape = [[CAShapeLayer alloc] init];
  25. shape.frame = CGRectMake(0, 0, self.shopBtn.mj_w, self.shopBtn.mj_h);
  26. [shape setPath:rounded.CGPath];
  27. self.shopBtn.layer.mask = shape;
  28. UIBezierPath* rounded1 = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, self.addCartBtn.mj_w, self.addCartBtn.mj_h) byRoundingCorners: UIRectCornerTopRight | UIRectCornerBottomRight cornerRadii:CGSizeMake(4, 4)];
  29. CAShapeLayer* shape1 = [[CAShapeLayer alloc] init];
  30. shape1.frame = CGRectMake(0, 0, self.addCartBtn.mj_w, self.addCartBtn.mj_h);
  31. [shape1 setPath:rounded1.CGPath];
  32. self.addCartBtn.layer.mask = shape1;
  33. }
  34. -(void)handle_shopEvent:(UIButton *)btn{
  35. [self generaltriggermethodType:1 data:@""];
  36. }
  37. -(void)handle_addCartEvent:(UIButton *)btn{
  38. [self generaltriggermethodType:2 data:@""];
  39. }
  40. - (QMUIButton *)shopBtn {
  41. if (!_shopBtn) {
  42. _shopBtn = [QMUIButton buttonWithType:UIButtonTypeCustom];
  43. _shopBtn.backgroundColor = [UIColor colorWithHexString:@"#82E8CD"];
  44. _shopBtn.frame = CGRectMake(10, 10, (self.mj_w-20)/3, 45);
  45. [_shopBtn setTitleColor:Col_000 forState:UIControlStateNormal];
  46. _shopBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:16];
  47. [_shopBtn setTitle:@"SHOP NOW" forState:UIControlStateNormal];
  48. [_shopBtn addTarget:self action:@selector(handle_shopEvent:) forControlEvents:UIControlEventTouchUpInside];
  49. }
  50. return _shopBtn;
  51. }
  52. - (QMUIButton *)addCartBtn {
  53. if (!_addCartBtn) {
  54. _addCartBtn = [[QMUIButton alloc]init];
  55. _addCartBtn.frame = CGRectMake((CGRectGetMaxX(self.shopBtn.frame)), 10, (self.mj_w-20)/3*2, 45);
  56. _addCartBtn.backgroundColor = [UIColor colorWithHexString:@"#32CFB0"];
  57. [_addCartBtn setTitleColor:Col_000 forState:UIControlStateNormal];
  58. _addCartBtn.titleLabel.font = [UIFont fontWithName:Rob_Bold size:16];
  59. [_addCartBtn setTitle:@"ADD TO CART" forState:UIControlStateNormal];
  60. [_addCartBtn setImage:[UIImage imageNamed:@"goods_add_cart"] forState:UIControlStateNormal];
  61. [_addCartBtn addTarget:self action:@selector(handle_addCartEvent:) forControlEvents:UIControlEventTouchUpInside];
  62. _addCartBtn.imagePosition = QMUIButtonImagePositionLeft;
  63. _addCartBtn.spacingBetweenImageAndTitle =10.0f;
  64. }
  65. return _addCartBtn;
  66. }
  67. @end