|
@@ -0,0 +1,541 @@
|
|
|
+//
|
|
|
+// ASGoodsDetailsSizeSelView.m
|
|
|
+// westkissMob
|
|
|
+//
|
|
|
+// Created by iOS on 2024/5/19.
|
|
|
+//
|
|
|
+
|
|
|
+#import "ASGoodsDetailsSizeSelView.h"
|
|
|
+
|
|
|
+@interface ASGoodsDetailsSizeSelView ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation ASGoodsDetailsSizeSelView
|
|
|
+
|
|
|
+-(void)setTipStr:(NSString *)tipStr {
|
|
|
+ _tipStr = tipStr;
|
|
|
+ CGFloat h = 84;
|
|
|
+ for (OptionsModel *m in self.optionArr) {
|
|
|
+ if (m.isLongValue) {
|
|
|
+ if (m.values.count > 0) {
|
|
|
+ NSInteger numLine = m.values.count/2 + (m.values.count%2>0 ? 1 : 0);
|
|
|
+ h += 40 * numLine + 10*(numLine-1) + 20 + 28;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (m.values.count > 0) {
|
|
|
+ NSInteger numLine = m.values.count/4 + (m.values.count%4>0 ? 1 : 0);
|
|
|
+ h += 40 * numLine + 10*(numLine-1) + 20+28;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// if (self.tipStr != nil && self.tipStr.length > 0) {
|
|
|
+// h += 60;
|
|
|
+// }
|
|
|
+ if (self.reloadHeight) {
|
|
|
+ self.reloadHeight(h);
|
|
|
+ }
|
|
|
+ if (self.reloadPrice){
|
|
|
+ self.reloadPrice();
|
|
|
+ }
|
|
|
+ [self reloadData];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)setOptionArr:(NSArray<OptionsModel *> *)optionArr {
|
|
|
+ _optionArr = optionArr;
|
|
|
+ CGFloat h = 84;
|
|
|
+ for (OptionsModel *m in optionArr) {
|
|
|
+ if (m.isLongValue) {
|
|
|
+ if (m.values.count > 0) {
|
|
|
+ NSInteger numLine = m.values.count/2 + (m.values.count%2>0 ? 1 : 0);
|
|
|
+ h += 40 * numLine + 10*(numLine-1) + 20 + 28;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (m.values.count > 0) {
|
|
|
+ NSInteger numLine = m.values.count/4 + (m.values.count%4>0 ? 1 : 0);
|
|
|
+ h += 40 * numLine + 10*(numLine-1) + 20+28;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+// if (self.tipStr != nil && self.tipStr.length > 0) {
|
|
|
+// h += 60;
|
|
|
+// }
|
|
|
+ if (self.reloadHeight) {
|
|
|
+ self.reloadHeight(h);
|
|
|
+ }
|
|
|
+ if (self.reloadPrice){
|
|
|
+ self.reloadPrice();
|
|
|
+ }
|
|
|
+ [self reloadData];
|
|
|
+}
|
|
|
+
|
|
|
+- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout {
|
|
|
+ UICollectionViewFlowLayout *ly = [[UICollectionViewFlowLayout alloc] init];
|
|
|
+ ly.scrollDirection = UICollectionViewScrollDirectionVertical;
|
|
|
+ self = [super initWithFrame:frame collectionViewLayout:ly];
|
|
|
+ if (self) {
|
|
|
+ self.num = 1;
|
|
|
+ self.showsVerticalScrollIndicator = false;
|
|
|
+ self.showsHorizontalScrollIndicator = false;
|
|
|
+ self.scrollEnabled = false;
|
|
|
+ self.backgroundColor = Col_FFF;
|
|
|
+ self.delegate = self;
|
|
|
+ self.dataSource = self;
|
|
|
+ [self registCell];
|
|
|
+ [self reloadData];
|
|
|
+ }
|
|
|
+ return self;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (void)registCell {
|
|
|
+ [self registerClass:[APProductDetailSizeHeadV class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"APProductDetailSizeHeadV"];
|
|
|
+ [self registerClass:[APProductDetailSizeCell class] forCellWithReuseIdentifier:@"APProductDetailSizeCell"];
|
|
|
+// [self registerClass:[APProductDetailSizeCell class] forCellWithReuseIdentifier:@"tipCell"];
|
|
|
+ [self registerClass:[APProductDetailNumStepCell class] forCellWithReuseIdentifier:@"APProductDetailNumStepCell"];
|
|
|
+}
|
|
|
+
|
|
|
+// MARK: - UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout
|
|
|
+
|
|
|
+- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
+ if (indexPath.section < self.optionArr.count) {
|
|
|
+ OptionsModel *m = self.optionArr[indexPath.section];
|
|
|
+ if ((!m.is_require.boolValue) && indexPath.row == m.optionSelectTag) {
|
|
|
+ m.optionSelectTag = -1;
|
|
|
+ if (self.reloadPrice) {
|
|
|
+ self.reloadPrice();
|
|
|
+ }
|
|
|
+ [collectionView reloadData];
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (m.values.count > indexPath.row) {
|
|
|
+ m.optionSelectTag = indexPath.row;
|
|
|
+ if (self.reloadPrice) {
|
|
|
+ self.reloadPrice();
|
|
|
+ }
|
|
|
+ [collectionView reloadData];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
|
|
|
+// return self.optionArr.count + 1 + (self.tipStr == nil || self.tipStr.length == 0 ? 0 : 1);
|
|
|
+ return self.optionArr.count + 1;
|
|
|
+}
|
|
|
+
|
|
|
+- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
|
|
|
+
|
|
|
+ if (section < self.optionArr.count) {
|
|
|
+ OptionsModel *m = self.optionArr[section];
|
|
|
+ return m.values.count;
|
|
|
+
|
|
|
+ }
|
|
|
+ return 1;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
+ if (indexPath.section < self.optionArr.count) {
|
|
|
+ OptionsModel *m = self.optionArr[indexPath.section];
|
|
|
+
|
|
|
+ APProductDetailSizeCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"APProductDetailSizeCell" forIndexPath:indexPath];
|
|
|
+ if (indexPath.row < m.values.count) {
|
|
|
+ OptionsValuesM *val = m.values[indexPath.row];
|
|
|
+ [cell setData:val];
|
|
|
+ }
|
|
|
+ [cell setSelType:m.optionSelectTag == indexPath.row isCat:m.isLongValue];
|
|
|
+ return cell;
|
|
|
+
|
|
|
+ }
|
|
|
+// if (self.tipStr != nil && self.tipStr.length > 0 && indexPath.section == self.optionArr.count) {
|
|
|
+// APProductDetailSizeCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"APProductDetailSizeCell" forIndexPath:indexPath];
|
|
|
+// [cell setTip:self.tipStr];
|
|
|
+// return cell;
|
|
|
+// }
|
|
|
+ APProductDetailNumStepCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"APProductDetailNumStepCell" forIndexPath:indexPath];
|
|
|
+ __weak typeof(self) weakSelf = self;
|
|
|
+ cell.numBlock = ^(NSString * _Nonnull num) {
|
|
|
+ weakSelf.num = num.integerValue;
|
|
|
+ if (self.reloadPrice) {
|
|
|
+ self.reloadPrice();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return cell;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
|
|
|
+ if ([kind isEqualToString:UICollectionElementKindSectionHeader]) {
|
|
|
+ APProductDetailSizeHeadV *v = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"APProductDetailSizeHeadV" forIndexPath:indexPath];
|
|
|
+ if (indexPath.section < self.optionArr.count) {
|
|
|
+ OptionsModel *m = self.optionArr[indexPath.section];
|
|
|
+ v.titleLb.text = m.title;
|
|
|
+ } else {
|
|
|
+ v.titleLb.text = @"Category";
|
|
|
+ }
|
|
|
+ return v;
|
|
|
+ }
|
|
|
+ return [[UICollectionReusableView alloc] init];
|
|
|
+}
|
|
|
+
|
|
|
+- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
+ if (indexPath.section < self.optionArr.count) {
|
|
|
+ OptionsModel *m = self.optionArr[indexPath.section];
|
|
|
+ if (m.isLongValue) {
|
|
|
+ CGFloat w = (SCREEN_WIDTH-30-10)/2;
|
|
|
+ return CGSizeMake(w, 40);
|
|
|
+ } else {
|
|
|
+ CGFloat w = (SCREEN_WIDTH-30-10*3)/4;
|
|
|
+ return CGSizeMake(w, 40);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ CGFloat w = (SCREEN_WIDTH-30);
|
|
|
+ return CGSizeMake(w, 72);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
|
|
|
+ if (section >= self.optionArr.count){
|
|
|
+ return CGSizeZero;
|
|
|
+ }
|
|
|
+ return CGSizeMake(SCREEN_WIDTH-30, 28);
|
|
|
+}
|
|
|
+
|
|
|
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
|
|
|
+ return 10;
|
|
|
+}
|
|
|
+
|
|
|
+- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
|
|
|
+ return 10;
|
|
|
+}
|
|
|
+
|
|
|
+- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
|
|
|
+ return UIEdgeInsetsMake(10, 15, 10, 15);
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+@interface APProductDetailSizeCell ()
|
|
|
+
|
|
|
+@property (nonatomic, strong) UIView *bgV;
|
|
|
+@property (nonatomic, strong) UIView *colorBg;
|
|
|
+@property (nonatomic, strong) UILabel *titleLb;
|
|
|
+@property (nonatomic, strong) UIImageView *selTipV;
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation APProductDetailSizeCell
|
|
|
+
|
|
|
+- (void)setData:(OptionsValuesM *)m {
|
|
|
+ self.titleLb.text = m.title;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+- (instancetype)initWithFrame:(CGRect)frame
|
|
|
+{
|
|
|
+ self = [super initWithFrame:frame];
|
|
|
+ if (self) {
|
|
|
+ [self loadSubV];
|
|
|
+ }
|
|
|
+ return self;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)setSelType:(BOOL)isSel isCat:(BOOL)isCat {
|
|
|
+ self.colorBg.hidden = true;
|
|
|
+ self.bgV.layer.borderWidth = 1;
|
|
|
+ self.bgV.backgroundColor = _F8F8F8;
|
|
|
+ self.bgV.layer.borderColor = isSel ? _32CFB0.CGColor : Col_FFF.CGColor;
|
|
|
+ self.selTipV.hidden = !isSel;
|
|
|
+ self.titleLb.font = [UIFont fontWithName:(isSel ? Rob_Bold : Rob_Regular ) size:(isCat ? 12 : 14)];
|
|
|
+}
|
|
|
+
|
|
|
+- (void)setTip:(NSString *)tipStr {
|
|
|
+ self.selTipV.hidden = true;
|
|
|
+ self.bgV.layer.borderWidth = 0;
|
|
|
+ self.bgV.backgroundColor = UIColor.clearColor;
|
|
|
+ self.colorBg.hidden = false;
|
|
|
+ self.titleLb.text = tipStr;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+- (void)loadSubV {
|
|
|
+ [self.contentView addSubview:self.colorBg];
|
|
|
+ [self.contentView addSubview:self.bgV];
|
|
|
+
|
|
|
+ [self.colorBg mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.edges.equalTo(self.contentView);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.bgV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.edges.equalTo(self.contentView);
|
|
|
+ }];
|
|
|
+ [self.bgV addSubview:self.titleLb];
|
|
|
+ [self.bgV addSubview:self.selTipV];
|
|
|
+ [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.leading.equalTo(self.bgV).offset(4);
|
|
|
+ make.bottom.trailing.equalTo(self.bgV).offset(-4);
|
|
|
+ }];
|
|
|
+ [self.selTipV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.trailing.bottom.equalTo(self.bgV);
|
|
|
+ make.width.height.equalTo(@12);
|
|
|
+ }];
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)layoutSubviews {
|
|
|
+ [super layoutSubviews];
|
|
|
+ dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
+// [self.colorBg lineColor:@[(__bridge id)_FFD1B9.CGColor,(__bridge id)_FFF5F0.CGColor] startPoint:CGPointMake(0, 0.5) endPoint:CGPointMake(1, 0.5) locations:@[@(0), @(1.0f)]];
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+- (UIView *)bgV {
|
|
|
+ if (!_bgV) {
|
|
|
+ UIView *v = [UIView baseV];
|
|
|
+ v.layer.borderWidth = 1;
|
|
|
+ v.backgroundColor = Col_FFF;
|
|
|
+ v.layer.borderColor = [UIColor colorWithHexString:@"#E6E6E6"].CGColor;
|
|
|
+ _bgV = v;
|
|
|
+ }
|
|
|
+ return _bgV;
|
|
|
+}
|
|
|
+
|
|
|
+- (UILabel *)titleLb {
|
|
|
+ if (!_titleLb) {
|
|
|
+ UILabel *lb = [UILabel baseLb];
|
|
|
+ lb.textAlignment = NSTextAlignmentCenter;
|
|
|
+ lb.textColor = Col_000;
|
|
|
+ lb.numberOfLines = 0;
|
|
|
+ lb.font = [UIFont fontWithName:Rob_Regular size:14];
|
|
|
+ _titleLb = lb;
|
|
|
+ }
|
|
|
+ return _titleLb;
|
|
|
+}
|
|
|
+
|
|
|
+- (UIImageView *)selTipV {
|
|
|
+ if (!_selTipV) {
|
|
|
+ UIImageView *imgv = [UIImageView baseImgV];
|
|
|
+ imgv.contentMode = UIViewContentModeScaleToFill;
|
|
|
+ imgv.image = [UIImage imageNamed:@"good_sizeSel"];
|
|
|
+ _selTipV = imgv;
|
|
|
+ }
|
|
|
+ return _selTipV;
|
|
|
+}
|
|
|
+
|
|
|
+- (UIView *)colorBg {
|
|
|
+ if (!_colorBg) {
|
|
|
+ UIView *v = [UIView baseV];
|
|
|
+ v.hidden = true;
|
|
|
+ _colorBg = v;
|
|
|
+ }
|
|
|
+ return _colorBg;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+
|
|
|
+@interface APProductDetailNumStepCell ()
|
|
|
+
|
|
|
+@property (nonatomic, strong) UILabel *titleLb;
|
|
|
+@property (nonatomic, strong) UIButton *minusBt;
|
|
|
+@property (nonatomic, strong) UILabel *numLb;
|
|
|
+@property (nonatomic, strong) UIButton *addBt;
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation APProductDetailNumStepCell
|
|
|
+
|
|
|
+- (void)addBtAction:(UIButton *)bt {
|
|
|
+// [bt sleep:0.3];
|
|
|
+ NSInteger num = self.numLb.text.integerValue;
|
|
|
+ if (num < 1) {
|
|
|
+ num = 1;
|
|
|
+ } else {
|
|
|
+ num += 1;
|
|
|
+ }
|
|
|
+ NSString *numStr = [NSString stringWithFormat:@"%ld", num];
|
|
|
+ self.numLb.text = numStr;
|
|
|
+ if (self.numBlock) {
|
|
|
+ self.numBlock(numStr);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (void)minusBtAction:(UIButton *)bt {
|
|
|
+// [bt sleep:0.3];
|
|
|
+ NSInteger num = self.numLb.text.integerValue;
|
|
|
+ if (num < 2) {
|
|
|
+ num = 1;
|
|
|
+ } else {
|
|
|
+ num -= 1;
|
|
|
+ }
|
|
|
+ NSString *numStr = [NSString stringWithFormat:@"%ld", num];
|
|
|
+ self.numLb.text = numStr;
|
|
|
+ if (self.numBlock) {
|
|
|
+ self.numBlock(numStr);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (instancetype)initWithFrame:(CGRect)frame
|
|
|
+{
|
|
|
+ self = [super initWithFrame:frame];
|
|
|
+ if (self) {
|
|
|
+ self.backgroundColor = UIColor.whiteColor;
|
|
|
+ [self loadSubV];
|
|
|
+ }
|
|
|
+ return self;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+- (void)loadSubV {
|
|
|
+
|
|
|
+ [self.contentView addSubview:self.titleLb];
|
|
|
+ [self.contentView addSubview:self.addBt];
|
|
|
+ [self.contentView addSubview:self.minusBt];
|
|
|
+ [self.contentView addSubview:self.numLb];
|
|
|
+// if(num >= self.goodsmaxNum){
|
|
|
+// [self.addBtn setTitleColor:[UIColor colorWithHexString:@"#E6E6E6"] forState:UIControlStateNormal];
|
|
|
+// self.addBtn.userInteractionEnabled = NO;
|
|
|
+// }else{
|
|
|
+// [self.addBtn setTitleColor:[UIColor colorWithHexString:@"#0B0B0B"] forState:UIControlStateNormal];
|
|
|
+// self.addBtn.userInteractionEnabled = YES;
|
|
|
+// }
|
|
|
+// if(num >= 2){
|
|
|
+// [self.cutBtn setTitleColor:[UIColor colorWithHexString:@"#0B0B0B"] forState:UIControlStateNormal];
|
|
|
+// self.cutBtn.userInteractionEnabled = YES;
|
|
|
+// }else{
|
|
|
+// [self.cutBtn setTitleColor:[UIColor colorWithHexString:@"#E6E6E6"] forState:UIControlStateNormal];
|
|
|
+// self.cutBtn.userInteractionEnabled = NO;
|
|
|
+// }
|
|
|
+
|
|
|
+ [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.mas_equalTo(20);
|
|
|
+ make.top.equalTo(self.contentView);
|
|
|
+ make.leading.equalTo(self.contentView);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.minusBt mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.height.mas_equalTo(32);
|
|
|
+ make.left.mas_equalTo(0);
|
|
|
+ make.top.equalTo(self.titleLb.mas_bottom).offset(10);
|
|
|
+ make.bottom.mas_equalTo(-10);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.numLb mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.height.equalTo(@32);
|
|
|
+ make.width.equalTo(@46);
|
|
|
+ make.left.equalTo(self.minusBt.mas_right).offset(1);
|
|
|
+ make.centerY.equalTo(self.minusBt);
|
|
|
+ }];
|
|
|
+
|
|
|
+ [self.addBt mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.width.height.equalTo(@32);
|
|
|
+ make.left.equalTo(self.numLb.mas_right).offset(1);
|
|
|
+ make.centerY.equalTo(self.minusBt);
|
|
|
+ }];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+- (UILabel *)titleLb {
|
|
|
+ if (!_titleLb) {
|
|
|
+ UILabel *lb = [UILabel baseLb];
|
|
|
+ lb.textColor = Col_000;
|
|
|
+ lb.text = @"Quantity";
|
|
|
+ lb.font = [UIFont fontWithName:Rob_Bold size:16];
|
|
|
+ _titleLb = lb;
|
|
|
+ }
|
|
|
+ return _titleLb;
|
|
|
+}
|
|
|
+
|
|
|
+- (UIButton *)addBt {
|
|
|
+ if (!_addBt) {
|
|
|
+ UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [bt setImage:[UIImage imageNamed:@"goods_num_add"] forState:UIControlStateNormal];
|
|
|
+ bt.layer.borderWidth = 1;
|
|
|
+ bt.layer.borderColor = [UIColor colorWithHexString:@"#E6E6E6"].CGColor;
|
|
|
+ [bt addTarget:self action:@selector(addBtAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _addBt = bt;
|
|
|
+ }
|
|
|
+ return _addBt;
|
|
|
+}
|
|
|
+
|
|
|
+- (UILabel *)numLb {
|
|
|
+ if (!_numLb) {
|
|
|
+ UILabel *lb = [UILabel baseLb];
|
|
|
+ lb.textAlignment = NSTextAlignmentCenter;
|
|
|
+ lb.textColor = Col_000;
|
|
|
+ lb.layer.borderColor = Col_000.CGColor;
|
|
|
+ lb.layer.borderWidth = 1;
|
|
|
+ lb.text = @"1";
|
|
|
+ lb.font = [UIFont fontWithName:Rob_Bold size:16];
|
|
|
+ _numLb = lb;
|
|
|
+ }
|
|
|
+ return _numLb;
|
|
|
+}
|
|
|
+
|
|
|
+- (UIButton *)minusBt {
|
|
|
+ if (!_minusBt) {
|
|
|
+ UIButton *bt = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ [bt setImage:[UIImage imageNamed:@"goods_num_minus"] forState:UIControlStateNormal];
|
|
|
+ bt.layer.borderWidth = 1;
|
|
|
+ bt.layer.borderColor = [UIColor colorWithHexString:@"#E6E6E6"].CGColor;
|
|
|
+ [bt addTarget:self action:@selector(minusBtAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ _minusBt = bt;
|
|
|
+ }
|
|
|
+ return _minusBt;
|
|
|
+}
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+
|
|
|
+@interface APProductDetailSizeHeadV ()
|
|
|
+
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+@implementation APProductDetailSizeHeadV
|
|
|
+
|
|
|
+
|
|
|
+- (instancetype)initWithFrame:(CGRect)frame
|
|
|
+{
|
|
|
+ self = [super initWithFrame:frame];
|
|
|
+ if (self) {
|
|
|
+ self.backgroundColor = Col_FFF;
|
|
|
+ [self loadSubV];
|
|
|
+ }
|
|
|
+ return self;
|
|
|
+}
|
|
|
+
|
|
|
+- (void)loadSubV {
|
|
|
+ [self addSubview:self.titleLb];
|
|
|
+ [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.top.equalTo(self).offset(10);
|
|
|
+ make.bottom.equalTo(self);//.offset(-5);
|
|
|
+ make.leading.equalTo(self).offset(15);
|
|
|
+ make.trailing.equalTo(self).offset(-15);
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+- (UILabel *)titleLb {
|
|
|
+ if (!_titleLb) {
|
|
|
+ UILabel *lb = [UILabel baseLb];
|
|
|
+ lb.textColor = Col_000;
|
|
|
+ lb.font = [UIFont fontWithName:Rob_Bold size:16];
|
|
|
+ _titleLb = lb;
|
|
|
+ }
|
|
|
+ return _titleLb;
|
|
|
+}
|
|
|
+
|
|
|
+@end
|