fixes #150: properly clear up user location annotations on mode toggle
Showing
1 changed file
with
5 additions
and
12 deletions
@@ -2915,21 +2915,14 @@ | @@ -2915,21 +2915,14 @@ | ||
2915 | 2915 | ||
2916 | [self setUserTrackingMode:RMUserTrackingModeNone animated:YES]; | 2916 | [self setUserTrackingMode:RMUserTrackingModeNone animated:YES]; |
2917 | 2917 | ||
2918 | - NSMutableArray *annotationsToRemove = [NSMutableArray array]; | 2918 | + for (RMAnnotation *annotation in [NSArray arrayWithObjects:_trackingHaloAnnotation, _accuracyCircleAnnotation, self.userLocation, nil]) |
2919 | + [self removeAnnotation:annotation]; | ||
2919 | 2920 | ||
2920 | - for (RMAnnotation *annotation in _annotations) | ||
2921 | - { | ||
2922 | - if (annotation.isUserLocationAnnotation) | ||
2923 | - [annotationsToRemove addObject:annotation]; | ||
2924 | - } | ||
2925 | - | ||
2926 | - for (RMAnnotation *annotationToRemove in annotationsToRemove) | ||
2927 | - { | ||
2928 | - [self removeAnnotation:annotationToRemove]; | ||
2929 | - } | 2921 | + [_trackingHaloAnnotation release]; _trackingHaloAnnotation = nil; |
2922 | + [_accuracyCircleAnnotation release]; _accuracyCircleAnnotation = nil; | ||
2930 | 2923 | ||
2931 | self.userLocation = nil; | 2924 | self.userLocation = nil; |
2932 | - } | 2925 | + } |
2933 | } | 2926 | } |
2934 | 2927 | ||
2935 | - (void)setUserLocation:(RMUserLocation *)newUserLocation | 2928 | - (void)setUserLocation:(RMUserLocation *)newUserLocation |
-
Please register or login to post a comment