iOS GoogleMaps SDK - animateToCameraPosition animation finished handler?

后端 未结 5 1888
离开以前
离开以前 2021-02-19 14:54

Currently I am using the GoogleMaps SDK for iOS for various operations. When calling

[self.googleMapsView animateToCameraPosition:[GMSCameraPosition 
                  


        
5条回答
  •  醉话见心
    2021-02-19 15:36

    SWIFT version example:

    let vancouver = CLLocationCoordinate2D(latitude: 49.26, longitude: -123.11)
    let calgary = CLLocationCoordinate2D(latitude: 51.05,longitude: -114.05)
    let bounds = GMSCoordinateBounds(coordinate: vancouver, coordinate: calgary)
    let cameraPosition = GMSCameraUpdate.fit(bounds)
    
    CATransaction.begin()
    CATransaction.setValue(1.0/*duration in seconds*/, forKey: kCATransactionAnimationDuration)
    CATransaction.setCompletionBlock({
        print("animation complete, do whatever you want here")
    })
    mMapView.animate(with: cameraPosition)
    CATransaction.commit()
    

提交回复
热议问题