地图SDK

作者: Look2021 | 来源:发表于2019-09-25 11:40 被阅读0次

百度地图SDK

判断定位是否打开
func locationIsOpen() -> Bool {
        if CLLocationManager.authorizationStatus() == CLAuthorizationStatus.denied {
            let vc = UIAlertController.init(title: "未开通定位权限", message: "请到设置中开通定位权限", cancelTitle: "取消", otherTitles: ["确定"], style: .alert) { (_) in
                
            }
            self.present(vc, animated: true, completion: nil)
            return false
        } else {
            return false
        }
    }
转为百度经纬度类型的坐标

let bd09Coord = BMKCoordTrans(coordinate, BMK_COORD_TYPE.COORDTYPE_GPS, BMK_COORD_TYPE.COORDTYPE_BD09LL);

让气泡直接显示

mapView.selectAnnotation(annotation, animated: true)

// 取出本地保存的围栏坐标
        let dict = UserDefaults.standard.dictionary(forKey: "FenceCoordinate") as? [String : String]
  if let latitude = dict?["latitude"], let longitude = dict?["longitude"] {
         circleCoordinate = CLLocationCoordinate2D(latitude: Double(latitude) ?? 0, longitude: Double(longitude) ?? 0)
        }

相关文章

网友评论

      本文标题:地图SDK

      本文链接:https://www.haomeiwen.com/subject/nwbiuctx.html