Flickering MapOverlay after zoom out and zoom in
I have two questions. First of all, once I allocate memory for the coordinates please see the code below, do I have to free memory free(coords)? Second, as you seen below code, I get overlay and add on the map. However, there is a different timestamps feeds coordinates and should update map. Like a radar map changing overlay shape with different time stamps.It is updating very well initially; however, once user zoom out and zoom in, it starts flashing or flickering. I wonder why this flickering happens? Anybody has experienced that problem before?
NSArray *ants = [mapView overlays];
for(bb = 0; bb < [polygonArray count]; bb++){
int attr=[[idArray objectAtIndex:bb]floatValue];
coords = malloc(sizeof(CLLocationCoordinate2D) * [[polygonArray objectAtIndex:bb] count]);
for (int a = 0;a < [[polygonArray objectAtIndex:bb] count]; a++){
coords[a].latitude = [[[[polygonArray objectAtIndex:bb]objectAtIndex:a]objectAtIndex:0]doubleValue];
coords[a].longitude = [[[[polygonArray objectAtIndex:bb]objectAtIndex:a]objectAtIndex:1]doubleValue];
}
polygon = [[MKPolygon alloc]init];
polygon = [MKPolygon polygonWithCoordinates:coords count:[[polygonArray objectAtIndex:bb]count]];
//free(coords);
[previousPolygons addObject:polygon];
}
[mapView addOverlay:polygon];
}
}
[mapView removeOverlays:ants];
Download Apples
BreadCrumbs Demo
App.
Using this Demo you see the recommended technic to do your task.
I have used that Demo in my App, and it worked like a charm.
The approach with MkPolygon does not work fine withn big polygons, or changing Polygons.
I have tested BreadCrumbs Demo on iOS 6.1 (iPad 3) and it flicker. It's a bug of the new MKMapView (sad). I have submitted the bug to Apple.
链接地址: http://www.djcxy.com/p/66034.html上一篇: SSRS水平显示数据集结果
下一篇: 缩小和放大后闪烁的MapOverlay