0
我試圖做一些花哨的旋轉(帶間距)的MapKit
動畫。有了這個代碼的iOS - MapKit相機旋轉動畫
func animateCamera() {
let newCamera: MKMapCamera? = mapView.camera
newCamera?.pitch = 90.0
newCamera?.heading = 180.0
newCamera?.altitude = 200.0
let camera: MKMapCamera? = mapView.camera
camera?.pitch = 0.0
camera?.heading = 360.0
camera?.altitude = 20.0
UIView.animate(withDuration: 3.0, delay: 0.0, options: ([.curveLinear, .beginFromCurrentState]), animations: {() -> Void in
self.mapView.setCamera(newCamera!, animated: true);
}, completion: {(_ finished: Bool) -> Void in
print("has not been interrupted : \(finished)")
})
UIView.animate(withDuration: 3.0, delay: 3.0, options: ([.curveLinear, .beginFromCurrentState]), animations: {() -> Void in
self.mapView.setCamera(camera!, animated: true);
}, completion: {(_ finished: Bool) -> Void in
print("has not been interrupted : \(finished)")
})
}
但是當我運行它只是捕捉到給定航向,俯仰和高度WITHOUT動畫功能。有什麼我錯過或做錯了?
在此先感謝!
謝謝Reinier! –