允许在缩放动画的同时与iOS Google Maps SDK配合使用

时间:2019-04-25 17:36:52

标签: swift dictionary sdk zoom bearing

我想在Google Map iOS上播放动画时使用捏缩放。我的问题是,每当我转动设备时,它都会设置缩放级别。我不想使用设置的缩放级别。我想在应用程序中添加捏缩放。

这是运行Xcode 10,Swift 4.2的macOS服务器。

@IBOutlet weak var mapView: GMSMapView!



var locationManager = CLLocationManager()
var userLocation = CLLocation()

var bearingAngle = 180.0
var angleOfView = 0.0
var zoomLevel : Float = 16
var capitolLat = 38.889815
var capitolLon = -77.005900

var userMarker = GMSMarker()

func locationManager(_ manager: CLLocationManager, didUpdateHeading newHeading: CLHeading) {
        let camera: GMSCameraPosition = GMSCameraPosition.camera(withLatitude: userLocation.coordinate.latitude, longitude: userLocation.coordinate.longitude, zoom: zoomLevel, bearing: bearingAngle, viewingAngle: angleOfView)


    self.mapView.animate(to: camera)

    mapView.animate(toBearing: newHeading.magneticHeading)
    userMarker.map = nil
    userMarker.position = CLLocationCoordinate2D(latitude: userLocation.coordinate.latitude, longitude: userLocation.coordinate.longitude)
    userMarker.iconView = yellow
    userMarker.groundAnchor = CGPoint(x: 0.5, y: 0.5)
    userMarker.map = mapView

我希望方位和收缩位置可以放大,而无需返回设置缩放比例。

0 个答案:

没有答案