// // RQHeadImageView.m // YJZS // // Created by 张嵘 on 2022/2/24. // #import "RQHeadImageView.h" @interface RQHeadImageView () @property (nonatomic, readwrite, strong) UIButton *locationBtn; @end @implementation RQHeadImageView - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { [self addSubview:self.locationBtn]; } return self; } - (void)didChangeToState:(HWIndicatorState)state { } - (CGSize)indicatorSize { return CGSizeMake(RQ_SCREEN_WIDTH, 54.f); } - (void)setupSubviews { @weakify(self) [self.locationBtn mas_remakeConstraints:^(MASConstraintMaker *make) { @strongify(self) make.centerY.mas_equalTo(self); make.right.mas_equalTo(self.mas_right).mas_offset(-16); make.size.mas_equalTo(CGSizeMake(RQ_FIT_HORIZONTAL(37), RQ_FIT_HORIZONTAL(37))); }]; } - (BOOL)isCustomIndicatorViewClickEnable { return YES; } #pragma mark - LazyLoad - (UIButton *)locationBtn { if (!_locationBtn) { _locationBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_locationBtn setImage:RQImageNamed(@"nei_meLocation") forState:UIControlStateNormal]; _locationBtn.backgroundColor = [UIColor whiteColor]; _locationBtn.contentEdgeInsets = UIEdgeInsetsMake(7, 7, 7, 7); _locationBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(37)/2; _locationBtn.layer.shadowOffset = CGSizeMake(2, 2); _locationBtn.layer.shadowRadius = 2; _locationBtn.layer.shadowColor = [UIColor darkGrayColor].CGColor;//shadowColor阴影颜色 _locationBtn.layer.shadowOpacity = 0.8;//阴影透明度,默认0 [_locationBtn setTapActionWithBlock:^(UITapGestureRecognizer *tap) { [LOCATION_MANAGER updateLocationWithDistanceFilter:1 CompleteBlock:^(BOOL success, CLLocation * _Nullable location, BMKLocation * _Nullable bmkLocation) { }]; }]; } return _locationBtn; } @end