2

我创建了一个 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 中的一个简单错误?

4

1 回答 1

-1

你用的是同款吗

    CLLocationCoordinate2D current = CLLocationCoordinate2DMake(latitude,longitude);

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:latitude
                                                        longitude:longitude
                                                             zoom:15];

纬度和经度?显然它不会起作用,因为没有任何改变......

于 2013-08-14T13:55:08.250 回答