First of all, I would like to point out that you are using deprecated methods. MKOverlayView
as deprecated in iOS7. That aside though, what you need to do is determine which type of overlay to return based on the overlay parameter passed to the delegate. So, if I were to modify your code, this is what I would do:
-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay
{
if ([overlay isKindOfClass:[MKCircle class]]) {
MKCircleView *circleView = [[MKCircleView alloc]initWithCircle:overlay];
circleView.fillColor = [[UIColor cyanColor] colorWithAlphaComponent:0.5];
circleView.strokeColor =[[UIColor blueColor] colorWithAlphaComponent:0.6];
circleView.lineWidth = 1 ;
return circleView;
} else if ([overlay isKindOfClass:[MKPolygon class]]) {
MKPolygonView *polygonView = [[MKPolygonView alloc] initWithPolygon:overlay];
polygonView.fillColor = [[UIColor greenColor] colorWithAlphaComponent:0.2];
polygonView.strokeColor = [[UIColor greenColor] colorWithAlphaComponent:0.6];
polygonView.lineWidth = 1;
return polygonView;
}
return nil;
}