1
我正在使用MKPolygon在UIMapView上進行疊加。以下是我目前的代碼:動態創建MKPolygon
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];
[commuterPoly1 setTitle:@"first"];
[self.overlayMap addOverlay:commuterPoly1];
現在,我正在實施json web服務,這將導致我所有的經度和緯度。但我無法從這些點創建覆蓋。任何人都可以幫助我使用動態點來實現疊加。
下面是我的服務響應:
{
response_code: 1,
response_message: "successful",
districts: [
{
district_id: "1",
district_name: "Austin",
Points: [
{
latitude: "39.048019",
longitude: "-76.850535"
},
{
latitude: "39.048027",
longitude: "-76.850234"
}
]
},
{
district_id: "2",
district_name: "Tulsa",
Points: [
{
latitude: "39.048019",
longitude: "-76.850535"
},
{
latitude: "39.048027",
longitude: "-76.850234"
},
{
latitude: "39.047407",
longitude: "-76.850181"
},
{
latitude: "39.047407",
longitude: "-76.8505"
},
{
latitude: "39.048019",
longitude: "-76.850535"
}
]
}
]
}
在此先感謝
非常感謝。有效。 –