我创建了一个 GMSMapVIew 对象,如代码所示。不幸的是,相机没有设置在正确的坐标上:
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:latitude
longitude:longitude
zoom:15];
mapView_ = [[GMSMapView alloc] initWithFrame:CGRectMake(505, 280, 427, 200)];
mapView_.camera = camera;
mapView_.myLocationEnabled = YES;
UIViewController *mapController = [[UIViewController alloc] initWithNibName:nil bundle:nil];
mapController.view = mapView_;
[self addChildViewController:mapController];
[self.view addSubview:mapView_];
我还尝试使用以下代码重新定位相机,但也没有成功:
CLLocationCoordinate2D current = CLLocationCoordinate2DMake(latitude,longitude);
GMSCameraUpdate *currentCam = [GMSCameraUpdate setTarget:current];
[mapView_ animateWithCameraUpdate:currentCam];
有没有人知道,我做错了什么,或者这只是 iOS 版 Google Maps 中的一个简单错误?