在 Google 地图中关闭视图后,我想关闭 GPS。但箭头并没有消失!
这是我的视图中的代码,称为 BlockMapView:
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:g_lat
longitude:g_lng
zoom:15];
self.mapView = [GMSMapView mapWithFrame:self.bounds camera:camera];
self.mapView.delegate = self;
self.mapView.trafficEnabled = YES;
self.mapView.myLocationEnabled = YES;
self.mapView.settings.myLocationButton = YES;
self.mapView.settings.compassButton = YES;
[self addSubview:self.mapView];
在 BlockMapView 的 ViewController 中,我想通过以下方式关闭 GPS:
- (void)viewWillDisappear:(BOOL)animated{
self.blockMapView.mapView.myLocationEnabled = NO;
但是GPS仍在运行,我已经等了20分钟......