0

I have a map view in my application which - among other things - displays the location of the user. Therefore my application will show the location arrow on the status bar but when I go to another view of the application the arrow does not disappear.

Therefore it seems that the application is still location the user - which should not be the case as the user is no longer on the view. Could I have forgot to "release" the user's location and if so, how will I do that?

//
// SET MAPVIEW
//

MKCoordinateRegion region = { {0.0, 0.0 }, { 0.0, 0.0 } };
region.center.latitude = 56.989808;
region.center.longitude = 9.656177;
region.span.longitudeDelta = 0.007f;
region.span.latitudeDelta = 0.003f;

[mapView setShowsUserLocation:TRUE];
[mapView setMapType:MKMapTypeHybrid];
[mapView setRegion:region animated:FALSE];
simonbs
  • 7,932
  • 13
  • 69
  • 115
  • I realized that I can use `[mapView setShowsUserLocation:FALSE]` in `-(void)viewDidDisappear:animated` Is this the right approach? – simonbs May 06 '11 at 07:03

1 Answers1

0

When you done with your location work then call -

[locationManager stopUpdatingLocation];

here locationManager is the instance of CLLocationManager.

saadnib
  • 11,145
  • 2
  • 33
  • 54
  • But I never made an instance of CLLocationManager. I believe it somehow lies in `[mapView setShowsUserLocation:TRUE]` – simonbs May 06 '11 at 07:13
  • 2
    then when you finished it then try to call it again wuth FALSE, [mapView setShowsUserLocation:FALSE] – saadnib May 06 '11 at 07:32
  • That's what I wrote in the comment to my original post. But it's great that you can confirm that it's the right approach. Thank you very much. – simonbs May 06 '11 at 08:42