RQHeadImageView.m 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // RQHeadImageView.m
  3. // YJZS
  4. //
  5. // Created by 张嵘 on 2022/2/24.
  6. //
  7. #import "RQHeadImageView.h"
  8. @interface RQHeadImageView ()
  9. @property (nonatomic, readwrite, strong) UIButton *locationBtn;
  10. @end
  11. @implementation RQHeadImageView
  12. - (instancetype)initWithFrame:(CGRect)frame {
  13. self = [super initWithFrame:frame];
  14. if (self) {
  15. [self addSubview:self.locationBtn];
  16. }
  17. return self;
  18. }
  19. - (void)didChangeToState:(HWIndicatorState)state {
  20. }
  21. - (CGSize)indicatorSize {
  22. return CGSizeMake(RQ_SCREEN_WIDTH, 54.f);
  23. }
  24. - (void)setupSubviews {
  25. @weakify(self)
  26. [self.locationBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
  27. @strongify(self)
  28. make.centerY.mas_equalTo(self);
  29. make.right.mas_equalTo(self.mas_right).mas_offset(-16);
  30. make.size.mas_equalTo(CGSizeMake(RQ_FIT_HORIZONTAL(37), RQ_FIT_HORIZONTAL(37)));
  31. }];
  32. }
  33. - (BOOL)isCustomIndicatorViewClickEnable {
  34. return YES;
  35. }
  36. #pragma mark - LazyLoad
  37. - (UIButton *)locationBtn {
  38. if (!_locationBtn) {
  39. _locationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  40. [_locationBtn setImage:RQImageNamed(@"nei_meLocation") forState:UIControlStateNormal];
  41. _locationBtn.backgroundColor = [UIColor whiteColor];
  42. _locationBtn.contentEdgeInsets = UIEdgeInsetsMake(7, 7, 7, 7);
  43. _locationBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(37)/2;
  44. _locationBtn.layer.shadowOffset = CGSizeMake(2, 2);
  45. _locationBtn.layer.shadowRadius = 2;
  46. _locationBtn.layer.shadowColor = [UIColor darkGrayColor].CGColor;//shadowColor阴影颜色
  47. _locationBtn.layer.shadowOpacity = 0.8;//阴影透明度,默认0
  48. [_locationBtn setTapActionWithBlock:^(UITapGestureRecognizer *tap) {
  49. [LOCATION_MANAGER updateLocationWithDistanceFilter:1 CompleteBlock:^(BOOL success, CLLocation * _Nullable location, BMKLocation * _Nullable bmkLocation) {
  50. }];
  51. }];
  52. }
  53. return _locationBtn;
  54. }
  55. @end