Created
February 3, 2011 00:57
-
-
Save evanlong/808845 to your computer and use it in GitHub Desktop.
Phantom lines appear on either the zero latitude or longitude axis if a point's latitude or longitudes settings are zero. Since both are zero in this case it will appear on both. This only occurs if the line width for the polyline is <= 1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewWillAppear:(BOOL)animated | |
{ | |
[super viewWillAppear:animated]; | |
CLLocationCoordinate2D points[2]; | |
points[0].latitude = 0; | |
points[0].longitude = 0; | |
points[1].latitude = -6; | |
points[1].longitude = 5; | |
MKPolyline* polyline = [MKPolyline polylineWithCoordinates:points count:2]; | |
[mapView addOverlay:polyline]; | |
[mapView setRegion:MKCoordinateRegionMake(CLLocationCoordinate2DMake(0, 0), MKCoordinateSpanMake(10, 10))]; | |
} | |
- (MKOverlayView*)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay | |
{ | |
MKPolylineView* polylineView = [[MKPolylineView alloc] initWithPolyline:overlay]; | |
polylineView.lineWidth = 1; | |
polylineView.strokeColor = [UIColor redColor]; | |
return [polylineView autorelease]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment