在缩小和放大iOS后,闪烁MapOverlay

我有两个问题。 首先,一旦我为坐标分配内存,请看下面的代码,我是否需要释放内存(坐标)? 其次,正如你在下面看到的代码,我得到覆盖,并在地图上添加。 但是,有不同的时间戳Feeds坐标,应该更新地图。 就像一张雷达图改变不同时间戳的叠加形状。 然而,一旦用户缩小和放大,它开始闪烁或闪烁。 我不知道为什么会发生这种闪烁? 有人遇到过这个问题吗?

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]; 

下载苹果

面包屑演示

应用。
使用这个演示,你会看到推荐的技术来完成你的任务。
我已经在我的应用程序中使用过这个Demo,它的function就像一个魅力。

MkPolygon的方法不适用于大的多边形或改变多边形。

我已经在iOS 6.1(iPad 3)上testing了BreadCrumbs Demo,并且闪烁。 这是新的MKMapView(悲伤)的错误。 我已经提交给苹果的错误。