我正在使用Google Maps SDK獲取當前位置。我的疑問是,如何使用使用Google Maps SDK的委託方法進行位置更新。有沒有用於獲取當前位置和位置更新的委託方法?如何使用Google Maps SDK更新位置
@implementation MyLocationViewController {
GMSMapView *mapView_;
}
- (void)viewDidLoad {
[super viewDidLoad];
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868 longitude:151.2086 zoom:12];
mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
mapView_.settings.compassButton = YES;
mapView_.settings.myLocationButton = YES;
// Listen to the myLocation property of GMSMapView.
[mapView_ addObserver:self forKeyPath:@"myLocation"
options:NSKeyValueObservingOptionNew context:NULL];
self.view = mapView_;
// Ask for My Location data after the map has already been added to the UI.
dispatch_async(dispatch_get_main_queue(), ^{
mapView_.myLocationEnabled = YES;
});
}
您應該使用「Google地圖」在您的iOS設備上顯示位置。 要獲取當前位置並重復更新,您應該使用「CLLocationManager」。讓我知道是否需要幫助。 –
@iCoderzDevelopers感謝您的回覆。你能否寄給我任何更新地點的樣本代碼。我需要一個委託方法..對於那個..我是新來的ios開發 – user3214012