从gps位置到地图

时间:2016-10-14 12:01:52

标签: ios google-maps

我有一个问题要问。 在我的应用程序中,我从GPS收集了用户位置。我还使用Google地图在地图上显示此位置。 我现在需要的是在我的地图上的这个位置保存图片并将其发布在Facebook上。或多或少与Runtastic相同。 有人可以帮我这样做吗? 我有GPS位置,然后我必须使用谷歌地图Api建立一个地图,然后拍照并将其作为链接发布在Facebook上。 我希望这对你来说已经足够清楚了。 非常感谢你。

2 个答案:

答案 0 :(得分:0)

您可以使用this method截取屏幕截图。在UIGraphicsBeginImageContextWithOptions中,您可以设置Google地图窗口的rect

使用Facebook SDK,您可以分享图片。

答案 1 :(得分:0)

这是获取特定视图的屏幕截图的代码

  

Swift 3.x代码

 UIGraphicsBeginImageContext(self.mapView.frame.size)
 self.mapView.layer.render(in: UIGraphicsGetCurrentContext()!)
 let image = UIGraphicsGetImageFromCurrentImageContext()
 UIGraphicsEndImageContext()

 // I used this on a imageView
 imageView.image = image

我的imageView就在按钮上方。

检查我的输出 enter image description here