开发者

How to make Location Services icon disappear from Status Bar?

开发者 https://www.devze.com 2023-03-17 05:29 出处:网络
My application doesn\'t need location service to constantly monitor user\'s location and I really don\'t want to drain battery, so on startup I get the location, send it to statistics server and call

My application doesn't need location service to constantly monitor user's location and I really don't want to drain battery, so on startup I get the location, send it to statistics server and call stopUpdatingLocation on my CLLocationManager instance. Icon disap开发者_如何学运维pears from status bar! :)

Next, in one of my tabs I have MKMapView in which user can ask for and see (using annotation) his current location. After I switch to another tab with different view I'd like to stop using location services. How to achieve this? I've read SO question What determines the presence of the iPhone Location Services icon in the status bar? and now I'm about to start thinking described use case is a bug in iOS (?).

EDIT: in view with MKMapView I don't use CLLocationManager at all.


In the viewDidDisappear method in the view controller that has the MKMapView, set the mapview's showsUserLocation property to NO.

- (void)viewDidDisappear:(BOOL)animated
{
    [super viewDidDisappear:animated];

    self.mapView.showsUserLocation = NO;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消