开发者

How to make Location Services icon disappear from Status Bar?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜