I recently started learning objectiveC and started developing an app in iOS6.
Now, I am trying to convert it for iOS7 and facing issues with MKMap.
In iOS6, I was using viewForOverlay.
In iOS7, I am changing it to renderForOverlay. But, my application is not calling mapView:rendererForOverlay. Below is my code. Appreciate your help.
- (void) drawPolyline:(NSArray *)locations
{
[mapView setDelegate:self];
...
...
self.polyline = [MKPolyline polylineWithCoordinates:locationCoordinate2DArray count:numberOfLocations];
free(locationCoordinate2DArray);
[mapView addOverlay:self.polyline];
[mapView setNeedsDisplay];
}
- (MKOverlayRenderer*)mapView:(MKMapView*)mapView rendererForOverlay:(id <MKOverlay>)overlay
{
MKPolylineRenderer* lineView = [[MKPolylineRenderer alloc] initWithPolyline:self.polyline];
lineView.strokeColor = [UIColor blueColor];
lineView.lineWidth = 7;
return lineView;
}
I am assuming that you did declare the MKMapViewDelegate
delegate in your header file via the @interface
statement:
However, did you assign the delegate in the viewDidLoad
(or where you think its appropriate) method?
self.mapView.delegate = self;