Ios GMSMapView跟踪模式航向
在我的应用程序中,我正在使用Ios GMSMapView跟踪模式航向,ios,objective-c,google-maps,gmsmapview,mkusertrackingmode,Ios,Objective C,Google Maps,Gmsmapview,Mkusertrackingmode,在我的应用程序中,我正在使用GMSMapView,我想更改跟踪模式。在iOS MapKit中,我可以将跟踪模式更改为MKUserTrackingModeFollowWithHeading,但不知道如何在GMSMapView中更改 在应用程序googlemaps中,第二次触摸myLocationButton后,它就开始工作了。有可能吗?要使用当前位置连续更改相机,您需要将谷歌地图的GMSCamera更新到当前位置。您可以在Location Manager委托方法中执行此操作 CLLocation
GMSMapView
,我想更改跟踪模式。在iOS MapKit中,我可以将跟踪模式更改为MKUserTrackingModeFollowWithHeading
,但不知道如何在GMSMapView
中更改
在应用程序
googlemaps
中,第二次触摸myLocationButton
后,它就开始工作了。有可能吗?要使用当前位置连续更改相机,您需要将谷歌地图的GMSCamera更新到当前位置。您可以在Location Manager委托方法中执行此操作
CLLocation *location;
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
//Get current latitude and longitude from didUpdateLocation
location = [locations lastObject];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:location.coordinate.latitude longitude:location.coordinate.longitude zoom:10 bearing:newHeading.trueHeading viewingAngle:0];
//You can change viewingAngle from 0 to 45
[self.mapForView animateToCameraPosition:camera];
}
如果您的代表没有接到电话,请从我的回答中寻求帮助
希望它能有所帮助。要连续更改相机的当前位置,您需要将谷歌地图的GMSCamera更新到当前位置。您可以在Location Manager委托方法中执行此操作
CLLocation *location;
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
//Get current latitude and longitude from didUpdateLocation
location = [locations lastObject];
}
-(void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:location.coordinate.latitude longitude:location.coordinate.longitude zoom:10 bearing:newHeading.trueHeading viewingAngle:0];
//You can change viewingAngle from 0 to 45
[self.mapForView animateToCameraPosition:camera];
}
如果您的代表没有接到电话,请从我的回答中寻求帮助
希望有帮助。你不明白我的问题。打开谷歌地图应用程序,然后单击我的位置按钮,它移动到你的位置,然后再次单击按钮,你将看到不同视角的地图(你可以用手机旋转)。我已根据你的要求编辑了我的答案。请查收。很高兴我能帮忙。:)你不明白我的问题。打开谷歌地图应用程序,然后点击我的位置按钮,它移动到你的位置,然后再次点击按钮,你会看到不同视角的地图(你可以用手机旋转)。我已经根据你的要求编辑了我的答案。请查收。很高兴我能帮忙。:)