0

I have a map in a tab of a tabbarcontroller. the user can go to another tab and re-set preferences and I need to re-draw the map when the user returns. I currently use this method to clean out and replot my new annotations:

- (IBAction)refreshTapped:(id)sender {
    //Clean out old annotations
    for (id<MKAnnotation> annotation in _mapView.annotations) {
        [_mapView removeAnnotation:annotation];
    }
    //THIS Adds the new annotations
    for (MyLocation *annotation in self.myLocationsToSort) {
        //Add annotation to mapview
        [_mapView addAnnotation:annotation];

    }

}

The problem is that I have a UIActivityIndicator being turned off in mapviewDidFinishLoading. So the second time the user returns to the map view the indicator never gets removed. Should that indicator be removed at the end of my plotting method or should I somehow force the view to reload the map view and thus call the mapviewDidFinishLoading method again?

4

1 に答える 1

0

最初のオプションを使用します。アクティビティ インジケーターが self.view.subviews に存在するかどうかを確認し、すべての新しい注釈のプロットが終了したら削除するかどうかを確認します。

于 2013-09-20T03:37:54.517 に答える