addOverlay和delegate

时间:2015-02-19 15:54:49

标签: ios objective-c delegates mkmapview

尝试在地图上绘制叠加多边形,但从不调用委托方法- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay ...

-(void)displayArea:(NSArray *)points{

   CLLocationCoordinate2D coordinates[6]  ={
        CLLocationCoordinate2DMake(47.64,7.59),
        CLLocationCoordinate2DMake(47.62,7.50),
        CLLocationCoordinate2DMake(47.57,7.45),
        CLLocationCoordinate2DMake(47.51,7.57),
         CLLocationCoordinate2DMake(47.61,7.66),
         CLLocationCoordinate2DMake(47.64,7.59),
    };

    MKPolygon * polygon = [MKPolygon polygonWithCoordinates:coordinates count:6];

    [self.myMap addOverlay:polygon level:MKOverlayLevelAboveLabels];
}

- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay{

    NSLog(@"mapview");


    return nil;
}

永远不会返回日志mapView,并且视图已正确连接到委托(viewController)。

真的无法理解....

网点截图:

enter image description here

0 个答案:

没有答案