1
我從Google Maps SDK for iOS(最新版本)中獲得Google Map。我在UIScrollerView
顯示的地圖是這樣的:旋轉到橫向時的Google Maps SDK for iOS問題
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_;
}
}
所以,當你從人像=>人像這一觀點進入它的工作原理。 從Landscape => Landscape進入此視圖時,它將起作用。
但是,當您從縱向=>縱向,然後在視圖中切換到橫向時,相機不再居中。另外,當你從風景=>風景進入這個視圖,然後變成肖像時,它就起作用。
任何想法如何修復相機的肖像=>景觀問題?
試過這個,但它似乎並沒有解決這個問題。地圖相機似乎仍指向偏離中心的某個地方。在界面方向更改後,似乎地圖邊界沒有正確更新。 – StephenT
發現問題(至少在我的情況下):需要更新到SDK的1.9.0以用於iPhone 6/6 +和iOS8 – StephenT