2016-07-05 69 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按鈕,移動到您的位置,然後再次單擊按鈕,您將看到具有不同視角的地圖(您可以用手機旋轉) –