2016-07-05 74 views
0

在我的应用程序中,我使用的是GMSMapView,我想更改跟踪模式。在iOS MapKit中,我可以将跟踪模式更改为MKUserTrackingModeFollowWithHeading,但不知道如何在GMSMapView中对其进行更改。GMSMapView跟踪模式标题

在应用程序Google Maps,它在myLocationButton第二次触摸后正在工作。可能吗?

回答

3

要连续更改当前位置的相机,您需要将Google地图的GMSCamera更新为当前位置。您可以在位置管理器委托方法中执行此操作。

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]; 
} 

如果你的委托不获取调用,以帮助从我的答案here

希望它能帮助。

+0

你不明白我的问题。 –

+0

请提供详细信息 – Bharat

+0

打开Goog​​le地图应用程序,然后点击myLocation按钮,移动到您的位置,然后再次单击按钮,您将看到具有不同视角的地图(您可以用手机旋转) –