I have been doing iOS dev for a few months. I already have a map view with a couple of annotations pinned to it and can show the users current location.
I haven been trying to read through the docs to implement a simple overlay using a set of CLLocationCoordinate2D to draw out a line (simple static route). Its has been a struggle
My MkOverlayRenderer method doesnt seem to be running at all. If I am not mistaking i shouldn't need the MKMapViewDelegate. I am trying to implement MKOverlay delegate and have "@synthesize boundingMapRect;".
Here is my code for trying to implement the Overlay
- (void)drawLineRoute
{
CLLocationCoordinate2D purplePoints[2];
purplePoints[0] = CLLocationCoordinate2DMake(28.541944, -81.382936);
purplePoints[1] = CLLocationCoordinate2DMake(28.538447, -81.383096);
MKPolyline *purplePolyline = [MKPolyline polylineWithCoordinates:purplePoints count:2];
purplePolyline.title = @"Citrus Bowl Connection";
[self.mapView addOverlay:purplePolyline];
}
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView viewForOverlay: (id<MKOverlay>)overlay
{
if([overlay isKindOfClass:[MKPolyline class]])
{
MKPolygonRenderer *polyRender = [[MKPolygonRenderer alloc] initWithOverlay:overlay];
polyRender.lineWidth = 2;
polyRender.strokeColor = ovoPurple;
return polyRender;
}
return nil;
}
Any help or guidance is greatly appreciated. Thank you all in advance.