谷歌地图SDK的iOS问题时,旋转到景观

谷歌地图SDK的iOS问题时,旋转到景观,ios,objective-c,google-maps,google-maps-sdk-ios,Ios,Objective C,Google Maps,Google Maps Sdk Ios,我有一个谷歌地图从谷歌地图SDK的iOS(最新版本)。我在UIScrollerView中显示这样的地图: showMarker = YES; GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:[geocodeLatitude floatValue] longitude:[geocodeLongitude floatValue] zoom:13]; [self setupMapWithCamera:camera wi

我有一个谷歌地图从谷歌地图SDK的iOS(最新版本)。我在
UIScrollerView
中显示这样的地图:

showMarker = YES;
GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:[geocodeLatitude floatValue] longitude:[geocodeLongitude floatValue] zoom:13];
[self setupMapWithCamera:camera withLatitude:geocodeLatitude withLongitude:geocodeLongitude];

float mapHeight = 50;
[mapView_ setFrame:CGRectMake(0, 0, widthOfBlock, mapHeight)];
[self.scroller addSubview:mapView_];
调用的方法是:

-(void)setupMapWithCamera:(GMSCameraPosition *)camera withLatitude:(NSString *)Slatitude withLongitude:(NSString *)Slongitude {
    // setup map
    [mapView_ clear];
    mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
    mapView_.settings.scrollGestures = NO;
    mapView_.settings.zoomGestures = NO;

    // setup marker
    if (geocodesuccess || showMarker) {
        GMSMarker *marker = [[GMSMarker alloc] init];
        marker.position = CLLocationCoordinate2DMake([Slatitude floatValue], [Slongitude floatValue]);
        if ([ShopWithDatas.open isEqualToString:@"1"] || [ShopWithDatas.open2424 isEqualToString:@"1"]) {
            marker.icon = [GMSMarker markerImageWithColor:[UIColor greenColor]];
        } else {
            marker.icon = [GMSMarker markerImageWithColor:[UIColor redColor]];
        }
        [mapView_ setSelectedMarker:marker];
        marker.map = mapView_;
    }    
}
因此,当您从纵向=>纵向在该视图中输入时,它会起作用。 当您从横向=>横向进入此视图时,它会起作用

但是当您从“纵向=>纵向”转到“横向”时,相机不再居中。另外,当您从横向=>横向进入此视图,然后转换为纵向时,它会起作用


你知道如何修复纵向=>横向问题的相机吗?

最后,即使我不知道为什么它不能正确更新,我还是找到了这个解决方案:

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
    if (canIshowMap) {
        CLLocationCoordinate2D actualLocation = CLLocationCoordinate2DMake([geocodeLatitude floatValue], [geocodeLongitude floatValue]);
        GMSCameraUpdate *updatedCamera = [GMSCameraUpdate setTarget:actualLocation];
        [mapView_ moveCamera:updatedCamera];
        //[mapView_ animateToLocation:actualLocation];        
    }
}

请注意,注释行没有修复该错误。

尝试了此操作,但似乎无法修复该问题。地图摄影机似乎仍然指向偏离中心的某个地方。界面方向更改后,地图边界似乎没有正确更新。发现问题(至少在我的案例中):需要更新到SDK的1.9.0,以便在iPhone 6/6+和iOS8上使用