Trying to find out if it works MKPolygon. I created a whole bunch of MKMapPoints and put them in an array. Then I draw a polygon from them:
[MKPolygon polygonWithPoints:pointArr count:sqlite3_column_int(countStatement, 0)]
and add this to the array for later retrieval.
Later I scroll through the array and add each object (MKPolygon) to the map with:
[mapView addOverlay:[overlays objectAtIndex:i]]
And this, according to the magazines, works great.
Then I implement mapView: viewForOverlay: like this
- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id <MKOverlay>)overlay {
MKOverlayView *theOverlayView = nil;
for (MKPolygon *theOverlay in overlays) {
if (theOverlay == overlay) {
MKPolygonView *thePolygonView = [[[MKPolygonView alloc] initWithPolygon:theOverlay] autorelease];
theOverlayView = thePolygonView;
}
}
return theOverlayView;
}
As far as I can see, this should technically work. But this is not so, the application simply crashes when it falls into the area of the map that I think (the points may be wrong due to a long drag and drop or a conversion error, but this is one more thing).
Am I missing a property that I need to set or errors may occur due to an error? Or will I skip it completely?
.