1

私は地図アプリケーションをやっています。地図上に注釈ピンを表示しています。ピンには、ピン アクセサリ ボタンをクリックするとアクセサリ ボタンがあり、ピンの詳細ページに移動します。詳細ページには、場所を削除するための削除ボタンがあります。途中で削除した後マップビューにポップすると、ピンがマップに表示されます.しかし、私のオブジェクト配列は1だけ減少します.しかし、ピンは以前のようにそれを解決する方法を示しています.私の要件は、ユーザーがマップビューにポップしたときにピンがマップに表示されない削除後です.ビュー.私を助けてください.....

4

1 に答える 1

0

最初にこのメソッドを試して、注釈を削除するときにこのメソッドを呼び出すだけです..

-(void) reloadMap
{
    [yourMapView setRegion:yourMapView.region animated:TRUE];
}

オプション

それ以外の場合は、すべての注釈を削除して、配列オブジェクトで再度追加します..このように注釈を削除します

 MKCoordinateRegion region;
 MKCoordinateSpan span;
 span.latitudeDelta=0.04;
 span.longitudeDelta=0.04;

region.span=span;  
region.center = currentLocation; 
[MymapView removeAnnotations:[MymapView annotations]];
MyAnnotation *ann = [[MyAnnotation alloc] init]; ///This is My Annotation class which i create for display detail of location
ann.title =MymapView.userLocation.title;  
ann.subtitle = MymapView.userLocation.subtitle;
ann.coordinate = currentLocation;
ann.annLocation=[NSString stringWithFormat:@"%f%f",currentLocation.longitude,currentLocation.latitude];
[MymapView addAnnotation:ann];

[MymapView setRegion:region animated:TRUE];
[MymapView regionThatFits:region];
于 2012-11-29T11:46:31.153 に答える