Skip to content

Commit

Permalink
Only add one route overlay - replace it each time.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmeierpolys committed Mar 23, 2012
1 parent 9855cf4 commit b623b66
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Classes/DetailViewController.h
Expand Up @@ -17,6 +17,7 @@
MFMailComposeViewControllerDelegate> { MFMailComposeViewControllerDelegate> {
CoreLocationController *CLController; CoreLocationController *CLController;
CLGeocoder *reverseGeo; CLGeocoder *reverseGeo;
MKPolyline *route;


MyLocation *tempAnnotation; MyLocation *tempAnnotation;


Expand Down Expand Up @@ -65,6 +66,7 @@
@property (nonatomic, retain) UIViewController *parentTable; @property (nonatomic, retain) UIViewController *parentTable;
@property (nonatomic, retain) NSDate *lastUpdate; @property (nonatomic, retain) NSDate *lastUpdate;
@property (nonatomic, retain) NSDate *idleTime; @property (nonatomic, retain) NSDate *idleTime;
@property (nonatomic, retain) MKPolyline *route;
@property CLLocationDegrees previousLat; @property CLLocationDegrees previousLat;
@property CLLocationDegrees previousLong; @property CLLocationDegrees previousLong;
@property int selectedLocationIndex; @property int selectedLocationIndex;
Expand Down
7 changes: 5 additions & 2 deletions Classes/DetailViewController.m
Expand Up @@ -27,6 +27,7 @@ @implementation DetailViewController
@synthesize idleTime; @synthesize idleTime;
@synthesize addresses; @synthesize addresses;
@synthesize appSettingsViewController; @synthesize appSettingsViewController;
@synthesize route;


- (IASKAppSettingsViewController*)appSettingsViewController { - (IASKAppSettingsViewController*)appSettingsViewController {
if (!appSettingsViewController) { if (!appSettingsViewController) {
Expand Down Expand Up @@ -313,8 +314,10 @@ - (void)drawRouteLines
i++; i++;
} }


MKPolyline *route = [MKPolyline polylineWithCoordinates: coordinates count: self.selectedTrip.locations.count]; MKPolyline *newRoute = [MKPolyline polylineWithCoordinates: coordinates count: self.selectedTrip.locations.count];
[self.mapView addOverlay:route]; [self.mapView addOverlay:newRoute];
[self.mapView removeOverlay:route];
route = newRoute;
} }


- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay { - (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay {
Expand Down
Binary file not shown.

0 comments on commit b623b66

Please sign in to comment.