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];
しかし、この行は青い点で私の場所も削除します! 自分の場所を削除せずにこれを行うにはどうすればよいですか。
よろしくお願いします。