【发布时间】:2015-06-09 07:45:57
【问题描述】:
我想在谷歌地图视图上添加多边形,但出现此错误
no visible @ interface GMSMapView declares the selector add overlay
代码:
CLLocationCoordinate2D commuterLotCoords[5]={
CLLocationCoordinate2DMake(39.048019,-76.850535),
CLLocationCoordinate2DMake(39.048027,-76.850234),
CLLocationCoordinate2DMake(39.047407,-76.850181),
CLLocationCoordinate2DMake(39.047407,-76.8505),
CLLocationCoordinate2DMake(39.048019,-76.850535)
};
MKPolygon *commuterPoly1 = [MKPolygon polygonWithCoordinates:commuterLotCoords count:5];
[mapView addOverlay:commuterPoly1];
【问题讨论】:
-
addOverlay方法是苹果的MKMapView,如果你想在你的谷歌MapView中添加折线,你必须先声明一个GMSMutablePath,然后将路径添加到@ 987654328@,然后将其添加到您的MapView,您可以查看this documentation了解更多详情。
标签: ios google-maps polygon