Permalink
Browse files

Only add one route overlay - replace it each time.

  • Loading branch information...
1 parent 9855cf4 commit b623b66be0ae2395ba41637d12c96faf0c4026a5 @nmeierpolys committed Mar 23, 2012
@@ -17,6 +17,7 @@
MFMailComposeViewControllerDelegate> {
CoreLocationController *CLController;
CLGeocoder *reverseGeo;
+ MKPolyline *route;
MyLocation *tempAnnotation;
@@ -65,6 +66,7 @@
@property (nonatomic, retain) UIViewController *parentTable;
@property (nonatomic, retain) NSDate *lastUpdate;
@property (nonatomic, retain) NSDate *idleTime;
+@property (nonatomic, retain) MKPolyline *route;
@property CLLocationDegrees previousLat;
@property CLLocationDegrees previousLong;
@property int selectedLocationIndex;
@@ -27,6 +27,7 @@ @implementation DetailViewController
@synthesize idleTime;
@synthesize addresses;
@synthesize appSettingsViewController;
+@synthesize route;
- (IASKAppSettingsViewController*)appSettingsViewController {
if (!appSettingsViewController) {
@@ -313,8 +314,10 @@ - (void)drawRouteLines
i++;
}
- MKPolyline *route = [MKPolyline polylineWithCoordinates: coordinates count: self.selectedTrip.locations.count];
- [self.mapView addOverlay:route];
+ MKPolyline *newRoute = [MKPolyline polylineWithCoordinates: coordinates count: self.selectedTrip.locations.count];
+ [self.mapView addOverlay:newRoute];
+ [self.mapView removeOverlay:route];
+ route = newRoute;
}
- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay {

0 comments on commit b623b66

Please sign in to comment.