我使用 MapView 并在其上设置注释(紫色大头针)和我的用户位置(蓝色圆圈)。因为紫色大头针注释会移动,所以我必须删除它们并将它们设置为新的地图。
我将其设置为:
CLLocationCoordinate2D coordinate;
coordinate.latitude = 49.2802;
coordinate.longitude = -123.1182;
NSUInteger count = 1;
for(int i = 0; i < 10; i++) {
CGFloat latDelta = rand()*.035/RAND_MAX - .02;
CGFloat longDelta = rand()*.03/RAND_MAX - .015;
CLLocationCoordinate2D newCoord = {coordinate.latitude+latDelta, coordinate.longitude+longDelta};
MyMapAnnotation* annotation = [[MyMapAnnotation alloc] initWithCoordinate:newCoord andID:count++];
[mapView addAnnotation:annotation];
[annotation release];
}
在此之前,我做了一个
[mapView removeAnnotations:mapView.annotations];
但是这条线也用蓝点删除了我的位置!我怎么能在不删除我的位置的情况下做到这一点。
非常感谢提前和最好的问候。