Ver Fonte

我的顶部可全部点击

桂欢 há 1 ano atrás
pai
commit
adc39848a3

+ 11 - 3
SLAiELTS/SLAiELTS/ViewControllers/MyVC/Views/Cells/SLMeHeaderCollectionViewCell.m

@@ -82,12 +82,22 @@ static const NSInteger btnTag = 888888;
         make.left.equalTo(self.nameLabel.mas_left);
         make.left.equalTo(self.nameLabel.mas_left);
     }];
     }];
     
     
-
     [self.setUpBtn mas_makeConstraints:^(MASConstraintMaker *make) {
     [self.setUpBtn mas_makeConstraints:^(MASConstraintMaker *make) {
         make.centerY.equalTo(self.headView);
         make.centerY.equalTo(self.headView);
         make.right.equalTo(self.bgImageView.mas_right).offset(-20);
         make.right.equalTo(self.bgImageView.mas_right).offset(-20);
     }];
     }];
     
     
+    UIView *tapView = [[UIView alloc] initWithFrame:CGRectZero];
+    tapView.backgroundColor = [UIColor clearColor];
+    tapView.userInteractionEnabled = YES;
+    [self.bgImageView addSubview:tapView];
+    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(headViewClick)];
+    [tapView addGestureRecognizer:tap];
+    [tapView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.right.equalTo(self.bgImageView);
+        make.top.bottom.equalTo(self.headView);
+    }];
+    
     
     
     WS(weakSelf);
     WS(weakSelf);
     [self.KVOController observe:[SLGlobalInfo SharedInstance] keyPath:@"loginInfo" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld block:^(id  _Nullable observer, id  _Nonnull object, NSDictionary<NSKeyValueChangeKey,id> * _Nonnull change) {
     [self.KVOController observe:[SLGlobalInfo SharedInstance] keyPath:@"loginInfo" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld block:^(id  _Nullable observer, id  _Nonnull object, NSDictionary<NSKeyValueChangeKey,id> * _Nonnull change) {
@@ -173,8 +183,6 @@ static const NSInteger btnTag = 888888;
         CGFloat radius = 26;
         CGFloat radius = 26;
         _headView.layer.cornerRadius = radius * KScaleW;
         _headView.layer.cornerRadius = radius * KScaleW;
         _headView.clipsToBounds = YES;
         _headView.clipsToBounds = YES;
-        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(headViewClick)];
-        [_headView addGestureRecognizer:tap];
         [self.bgImageView addSubview:_headView];
         [self.bgImageView addSubview:_headView];
     }
     }
     return _headView;
     return _headView;