有没有Google地图等同于mkmapsnapshotter? [英] Is there a Google Maps equivalent to mkmapsnapshotter?
问题描述
我有一个 UITableView
,它可能包含大量的单元格,并且在某些单元格中,我想要一个 UIImageView
显示一个位置的地图,其坐标仅在运行时已知。
我希望表格视图平滑滚动,我希望单元格中的地图能够不可滚动。
我已经被指示避开Apple Maps。此外, MKMapSnapshotter
是iOS 7及更高版本。我必须支持iOS 6。
Google地图图像API 我的最佳选择?
我已经在使用 Google Maps iOS SDK ,所以我想尽可能使用它。但它有这个功能吗?相当于 MKMapSnapshotter
?我很惊讶,我在文档中找不到它。 曾经有一个 GMSScreenshot
类的SDK,可用于截屏。但是在v1.2中,Google删除了这个,因为您可以使用 renderInContext
代替。您可以在这里看到一些背景信息和示例代码:
Google Maps IOS SDK 1.2需要地图视图的快照
发布在Google Maps SDK for iOS上捕获GMSMapView的屏幕截图
https://developers.google.com/maps/documentation/ios/releases#version_12_-_april_2013
我认为虽然 renderInContext
(以及之前的 GMSScreenshot
)专为截取已存在于视图中的地图视图的屏幕截图而设计有一段时间,下载了地图图块等。我不确定如果您在广告管理系统中创建了地图视图,效果会很好ckground,将相机位置设置为所需的纬度/经度,将其渲染为图像,然后重复其他位置。
I have a UITableView
which may potentially contain a large number of cells, and in some cells I want a UIImageView
showing a map of a location, the coordinates of which are known only at runtime.
I want the table view to scroll smoothly and I want the maps in the cells to not be scrollable at all.
I've been directed to avoid Apple Maps. Besides, MKMapSnapshotter
is iOS 7 and up. I have to support iOS 6.
So is Google Maps image API my best option?
I'm already using the Google Maps iOS SDK anyway, so I'd like to use it for this if possible. But does it have this feature? An equivalent to MKMapSnapshotter
? I'm surprised I can't find it in the documentation.
There used to be a GMSScreenshot
class in the SDK, that could be used to take screenshots. However in v1.2 Google removed this, as you could use renderInContext
instead. You can see some background info and sample code here:
Google Maps IOS SDK 1.2 need snapshot of map view
Issue taking screen capture of GMSMapView on Google Maps SDK for iOS
https://developers.google.com/maps/documentation/ios/releases#version_12_-_april_2013
I think though that renderInContext
(and GMSScreenshot
before it) is designed for taking a screenshot of a map view that is already on a view, has been displayed for a while, has downloaded map tiles etc. I'm not sure that it would work well if you created a map view in the background, set the camera position to your desired lat/lon, rendered it to an image, and then repeated for the other locations you want.
So, I suspect that the Google Maps image API would work better for what you are doing.
这篇关于有没有Google地图等同于mkmapsnapshotter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!