iOS Google Map SDK:将 Google 地图缩放级别更改为 GMSCameraUpdate:fitBounds:withEdgeInsets
iOS Google Map SDK : Change Google Map Zoom Level with GMSCameraUpdate:fitBounds:withEdgeInsets
我想使用 GMSCameraUpdate:fitBounds:withEdgeInsets
更改 iOS Google Map SDK 缩放级别。但问题是 Google 地图在我使用 GMSCameraUpdate:fitBounds:withEdgeInsets
时采用默认缩放级别。这里我使用 withEdgeInsets
来改变地图位置。任何帮助将不胜感激。
下面是我的完整代码。
GMSCoordinateBounds *markerBounds = [[GMSCoordinateBounds alloc] initWithPath:gmsPath];
GMSCameraUpdate *updatedCamera = [GMSCameraUpdate fitBounds:markerBounds withEdgeInsets:UIEdgeInsetsMake(-500, 0, 0, 0)];
[mapView_ animateWithCameraUpdate:updatedCamera];
此处 gmsPath
包含 [GMSMutablePath path]
的多个坐标。
当我使用 [mapView_ animateToZoom:10];
时,withEdgeInsets
不起作用。
我搜索了 google 和 Whosebug,但找不到正确的结果。
您可能应该调整地图大小以适应可用 space,而不是使用边缘插图来获得相同的效果。特别是,调整地图大小将确保 Google 徽标可见,这是使用 SDK 的要求。
如果您不想那样做,那么我认为您应该使用 UIEdgeInsetsMake(0, 0, 500, 0)
之类的东西,即在底部边缘插入正数,而不是在顶部边缘插入负数。您应该使用 table(以磅为单位)的高度,而不是硬编码 500
。
我找到了 UIEdgeInsetsMake
的解决方案。以下是解决方法。
GMSCoordinateBounds *markerBounds = [[GMSCoordinateBounds alloc] initWithPath:gmsPath];
GMSCameraUpdate *updatedCamera = [GMSCameraUpdate fitBounds:markerBounds withEdgeInsets:UIEdgeInsetsMake(44, 0, self.view.frame.size.height - 180, 0)];
[mapView_ animateWithCameraUpdate:updatedCamera];
-180 是可用的 space 以上 UITableView
我想使用 GMSCameraUpdate:fitBounds:withEdgeInsets
更改 iOS Google Map SDK 缩放级别。但问题是 Google 地图在我使用 GMSCameraUpdate:fitBounds:withEdgeInsets
时采用默认缩放级别。这里我使用 withEdgeInsets
来改变地图位置。任何帮助将不胜感激。
下面是我的完整代码。
GMSCoordinateBounds *markerBounds = [[GMSCoordinateBounds alloc] initWithPath:gmsPath];
GMSCameraUpdate *updatedCamera = [GMSCameraUpdate fitBounds:markerBounds withEdgeInsets:UIEdgeInsetsMake(-500, 0, 0, 0)];
[mapView_ animateWithCameraUpdate:updatedCamera];
此处 gmsPath
包含 [GMSMutablePath path]
的多个坐标。
当我使用 [mapView_ animateToZoom:10];
时,withEdgeInsets
不起作用。
我搜索了 google 和 Whosebug,但找不到正确的结果。
您可能应该调整地图大小以适应可用 space,而不是使用边缘插图来获得相同的效果。特别是,调整地图大小将确保 Google 徽标可见,这是使用 SDK 的要求。
如果您不想那样做,那么我认为您应该使用 UIEdgeInsetsMake(0, 0, 500, 0)
之类的东西,即在底部边缘插入正数,而不是在顶部边缘插入负数。您应该使用 table(以磅为单位)的高度,而不是硬编码 500
。
我找到了 UIEdgeInsetsMake
的解决方案。以下是解决方法。
GMSCoordinateBounds *markerBounds = [[GMSCoordinateBounds alloc] initWithPath:gmsPath];
GMSCameraUpdate *updatedCamera = [GMSCameraUpdate fitBounds:markerBounds withEdgeInsets:UIEdgeInsetsMake(44, 0, self.view.frame.size.height - 180, 0)];
[mapView_ animateWithCameraUpdate:updatedCamera];
-180 是可用的 space 以上 UITableView