swift - 获取MKMapView中心的经纬度
问题描述
我希望当用户单击地图中心存在的按钮时,地图被锁定并且我得到地图的纬度和经度,实际上得到地图的中心我不想使用谷歌地图或 Mapbox 我想使用地图套件
解决方案
试试下面的代码:
@IBAction func aaa(_ sender: UIButton) {
print(self.mapView.centerCoordinate.latitude)
print(self.mapView.centerCoordinate.longitude)
}
推荐阅读
- python - 在 SciPy (Python) 中从拟合 PDF 生成随机样本
- javascript - LoopBack 和 MongoDb,embadsMany 关系返回空数组
- javascript - 将二进制 ArrayBuffer/TypedArray 数据转换为十六进制字符串
- java - 在 JavaFX 中对文本文件进行排序
- linux - 如何从文件的每一行中获取元素,并将它们添加到不同文件的每一行中的每个条目?
- javascript - 选择项的功能
- aws-lambda - 在保持迭代器输出的同时将输入传递给 Step Function 中的迭代器
- c# - 如何使用 XPATH 将元素添加到行项目
- java - 使用 CompletableFuture 的异步计算,它在 for 每个循环中返回一个对象
- gatsby - Gatsby:生成嵌套的动态路由