HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ios – Google地图缩小到GPS和标记大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图在地图上显示三件事情:
GPS(当前位置),Marker 1,Marker 2,但我不知道我做得对不对!这是我的代码
self.startMarker.position = CL@R_801_5352@nCoordinate2D(latitude: self.startLatitude,longitude: self.startLongitudE)
 self.startMarker.icon = #imageLiteral(resourcename: "Pin Start")
 self.startMarker.map = self.mapView


 self.endMarker.position = CL@R_801_5352@nCoordinate2D(latitude: self.endLatitude,longitude: self.endLongitudE)
 self.endMarker.icon = #imageLiteral(resourcename: "Pin End")
 self.endMarker.map = self.mapView


 let southWest = CL@R_801_5352@nCoordinate2DMake(self.startLatitude,self.startLongitudE)
 let northEast = CL@R_801_5352@nCoordinate2DMake(self.endLatitude,self.endLongitudE)
 let bounds = GMSCoordinateBounds(coordinate: northEast,coordinate: southWest)
 let camera = self.mapView.camera(for: bounds,insets:.zero)
 self.mapView.camera = camera!

更多代码

// MARK: - Google Map

private func @R_801_5352@nManager(manager: CL@R_801_5352@nManager,didChangeAuthorizationStatus status: CLAuthorizationStatus) {
            if status == CLAuthorizationStatus.authorizedWhenInUse {
                mapView.isMy@R_801_5352@nEnabled = true
            }
          }
func @R_801_5352@nManager(_ manager: CL@R_801_5352@nManager,didupdate@R_801_5352@ns @R_801_5352@ns: [CL@R_801_5352@n]) {
            let new@R_801_5352@n = @R_801_5352@ns.last
            mapView.camera = GMSCameraPosition.camera(withTarget: new@R_801_5352@n!.coordinate,zoom: 14)
            mapView.isMy@R_801_5352@nEnabled = true
        }

结果是这样的

我需要的 :

@L_607_4@

EDITED

if let my@R_801_5352@n = self.mapView.my@R_801_5352@n {

let path = GMSMutablePath()
path.add(my@R_801_5352@n.coordinatE)
path.add(self.startMarker.position)
path.add(self.endMarker.position)

let bounds = GMSCoordinateBounds(path: path)
                                        self.mapView.animate(with: GMSCameraupdate.fit(bounds,withPadding: 40))

}

解决方法

@H_673_26@ 显示屏幕界限的所有标记

在这里我试图给你一个简单的例子,希望这将有助于你.
使用此功能,您可以在屏幕上显示任意数量标记.

例:

let path = GMSMutablePath()
for var i in 0 ..< array.count
{
    let lat = Double(array.objectATindex(i).valueForKey(lattitudE) as! String)
    let long = Double(arrayr.objectATindex(i).valueForKey(longitudE) as! String)      
    marker.position = CL@R_801_5352@nCoordinate2DMake(lat!,long!)
    path.addCoordinate(marker.position)
    marker.map = self.mapView
}
let bounds = GMSCoordinateBounds(path: path)
self.mapView!.animateWithCameraupdate(GMSCameraupdate.fitBounds(bounds,withPadding: 30.0))

大佬总结

以上是大佬教程为你收集整理的ios – Google地图缩小到GPS和标记全部内容,希望文章能够帮你解决ios – Google地图缩小到GPS和标记所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。