fix tint adjustment dimming
Showing
2 changed files
with
36 additions
and
0 deletions
@@ -48,6 +48,7 @@ | @@ -48,6 +48,7 @@ | ||
48 | #import "RMLoadingTileView.h" | 48 | #import "RMLoadingTileView.h" |
49 | 49 | ||
50 | #import "RMUserLocation.h" | 50 | #import "RMUserLocation.h" |
51 | +#import "RMUserTrackingBarButtonItem.h" | ||
51 | 52 | ||
52 | #import "RMAttributionViewController.h" | 53 | #import "RMAttributionViewController.h" |
53 | 54 | ||
@@ -119,6 +120,14 @@ | @@ -119,6 +120,14 @@ | ||
119 | 120 | ||
120 | #pragma mark - | 121 | #pragma mark - |
121 | 122 | ||
123 | +@interface RMUserTrackingBarButtonItem (PrivateMethods) | ||
124 | + | ||
125 | +@property (nonatomic, assign) UIViewTintAdjustmentMode tintAdjustmentMode; | ||
126 | + | ||
127 | +@end | ||
128 | + | ||
129 | +#pragma mark - | ||
130 | + | ||
122 | @implementation RMMapView | 131 | @implementation RMMapView |
123 | { | 132 | { |
124 | id <RMMapViewDelegate> _delegate; | 133 | id <RMMapViewDelegate> _delegate; |
@@ -188,6 +197,8 @@ | @@ -188,6 +197,8 @@ | ||
188 | UIImageView *_userHeadingTrackingView; | 197 | UIImageView *_userHeadingTrackingView; |
189 | UIImageView *_userHaloTrackingView; | 198 | UIImageView *_userHaloTrackingView; |
190 | 199 | ||
200 | + RMUserTrackingBarButtonItem *_userTrackingBarButtonItem; | ||
201 | + | ||
191 | UIViewController *_viewControllerPresentingAttribution; | 202 | UIViewController *_viewControllerPresentingAttribution; |
192 | UIButton *_attributionButton; | 203 | UIButton *_attributionButton; |
193 | UIPopoverController *_attributionPopover; | 204 | UIPopoverController *_attributionPopover; |
@@ -2645,6 +2656,15 @@ | @@ -2645,6 +2656,15 @@ | ||
2645 | // | 2656 | // |
2646 | ((RMCircle *)_accuracyCircleAnnotation.layer).fillColor = [self.tintColor colorWithAlphaComponent:0.1]; | 2657 | ((RMCircle *)_accuracyCircleAnnotation.layer).fillColor = [self.tintColor colorWithAlphaComponent:0.1]; |
2647 | } | 2658 | } |
2659 | + | ||
2660 | + if (_userTrackingBarButtonItem) | ||
2661 | + { | ||
2662 | + if (self.tintAdjustmentMode == UIViewTintAdjustmentModeDimmed || _userTrackingBarButtonItem.tintAdjustmentMode == UIViewTintAdjustmentModeDimmed) | ||
2663 | + { | ||
2664 | + _userTrackingBarButtonItem.tintAdjustmentMode = self.tintAdjustmentMode; | ||
2665 | + _userTrackingBarButtonItem.tintColor = self.tintColor; | ||
2666 | + } | ||
2667 | + } | ||
2648 | } | 2668 | } |
2649 | 2669 | ||
2650 | #pragma mark - | 2670 | #pragma mark - |
@@ -3726,6 +3746,11 @@ | @@ -3726,6 +3746,11 @@ | ||
3726 | } | 3746 | } |
3727 | } | 3747 | } |
3728 | 3748 | ||
3749 | +- (void)setUserTrackingBarButtonItem:(RMUserTrackingBarButtonItem *)userTrackingBarButtonItem | ||
3750 | +{ | ||
3751 | + _userTrackingBarButtonItem = userTrackingBarButtonItem; | ||
3752 | +} | ||
3753 | + | ||
3729 | #pragma mark - | 3754 | #pragma mark - |
3730 | #pragma mark Attribution | 3755 | #pragma mark Attribution |
3731 | 3756 |
@@ -38,12 +38,21 @@ typedef enum { | @@ -38,12 +38,21 @@ typedef enum { | ||
38 | RMUserTrackingButtonStateHeading = 3 | 38 | RMUserTrackingButtonStateHeading = 3 |
39 | } RMUserTrackingButtonState; | 39 | } RMUserTrackingButtonState; |
40 | 40 | ||
41 | +@interface RMMapView (PrivateMethods) | ||
42 | + | ||
43 | +@property (nonatomic, weak) RMUserTrackingBarButtonItem *userTrackingBarButtonItem; | ||
44 | + | ||
45 | +@end | ||
46 | + | ||
47 | +#pragma mark - | ||
48 | + | ||
41 | @interface RMUserTrackingBarButtonItem () | 49 | @interface RMUserTrackingBarButtonItem () |
42 | 50 | ||
43 | @property (nonatomic, strong) UISegmentedControl *segmentedControl; | 51 | @property (nonatomic, strong) UISegmentedControl *segmentedControl; |
44 | @property (nonatomic, strong) UIImageView *buttonImageView; | 52 | @property (nonatomic, strong) UIImageView *buttonImageView; |
45 | @property (nonatomic, strong) UIActivityIndicatorView *activityView; | 53 | @property (nonatomic, strong) UIActivityIndicatorView *activityView; |
46 | @property (nonatomic, assign) RMUserTrackingButtonState state; | 54 | @property (nonatomic, assign) RMUserTrackingButtonState state; |
55 | +@property (nonatomic, assign) UIViewTintAdjustmentMode tintAdjustmentMode; | ||
47 | 56 | ||
48 | - (void)createBarButtonItem; | 57 | - (void)createBarButtonItem; |
49 | - (void)updateState; | 58 | - (void)updateState; |
@@ -139,6 +148,8 @@ typedef enum { | @@ -139,6 +148,8 @@ typedef enum { | ||
139 | [_mapView addObserver:self forKeyPath:@"userTrackingMode" options:NSKeyValueObservingOptionNew context:nil]; | 148 | [_mapView addObserver:self forKeyPath:@"userTrackingMode" options:NSKeyValueObservingOptionNew context:nil]; |
140 | [_mapView addObserver:self forKeyPath:@"userLocation.location" options:NSKeyValueObservingOptionNew context:nil]; | 149 | [_mapView addObserver:self forKeyPath:@"userLocation.location" options:NSKeyValueObservingOptionNew context:nil]; |
141 | 150 | ||
151 | + _mapView.userTrackingBarButtonItem = self; | ||
152 | + | ||
142 | [self updateState]; | 153 | [self updateState]; |
143 | } | 154 | } |
144 | } | 155 | } |
-
Please register or login to post a comment