のために、私はMKMapViewを使用するアプリケーションを持っているアプリの中でいくつかの点で私はMKAnnotationViewがuserLocationピンiPhone
[mapView removeAnnotations:mapView.annotations]
を使用してマップ内のすべての現在のピンを削除する必要があります。そして、私は再び電流を表示したいですユーザーの場所
mapView.showUserLocation = YES
しかし、私はだけなので、私はそのタイプのビューを返しカントuserLocationビュークラスのパブリックではないので、それは、通常のピンとして再表示させることができます。ここで
MKUserLocationView
は、現在位置を表示するために使用されるクラスですが、それも、私はリフレクションを通じて発見した私のコード
- (MKAnnotationView *)mapView:(MKMapView *)theMapView viewForAnnotation:(id<MKAnnotation>)annotation
MKPinAnnotationView* annView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"currentloc"];
if (!annView) {
MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"currentloc"];
annView.pinColor = MKPinAnnotationColorRed;
annView.animatesDrop=TRUE;
annView.canShowCallout = YES;
annView.calloutOffset = CGPointMake(-5, 5);
if ([annotation isKindOfClass:[DraggableAnnotationAM class]]) annView.draggable =YES;
return annView;
}
else {
if ([annotation isKindOfClass:[DraggableAnnotationAM class]]) annView.draggable = YES;
annView.annotation = annotation;
return annView;
}
でその使用が安全ではないと私のアプリの公開ではないので、クラッシュし続けているし、確かに簡単な方法です。
mapViewのユーザーの場所の注釈を削除しないでください。事前