我有一个包含一个实例的类MKMapView
@property(nonatomic, weak) IBOutlet MKMapView *ibMapView;
虽然我CLLocationManager
在项目的其他地方也使用了单例实例,但我发现这个地图视图负责 iPhone 状态栏上显示的“位置”图标。
具体来说,这段代码是罪魁祸首:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// If I comment out this line below, the "Location" status icon never shows, as expected
self.ibMapView.showsUserLocation = YES;
// ...other magical stuff happens here, not related to map view
}
我试过showsUserLocation
这样设置为 NO
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
self.ibMapView.showsUserLocation = NO;
// I also have tried logging to make sure showUserLocation is set to NO- returns "NO" as expected
DebugLog(@"Show User Location: %@", self.ibMapView.showsUserLocation ? @"YES" : @"NO");
// ...other stuff happens here, not related to map view...
}
但是,位置状态图标仍然显示...它永远不会关闭,即使经过一个小时后...
如何让在实例上设置showUserLocation
为 YES导致的位置状态图标消失?MKMapView