1
在線幾個示例後,我試圖爲MKAnnotationView創建動畫。我已經放置在init下面的代碼()我MKAnnotationView子類:嘗試動畫MKAnnotationView時應用程序崩潰
UIView.animate(withDuration: 10.0, delay: 0.0, options: .repeat, animations: {
UIView.addKeyframe(withRelativeStartTime: 0.0, relativeDuration: 0.5, animations: {
self.frame = biggerFrame
})
UIView.addKeyframe(withRelativeStartTime: 0.5, relativeDuration: 0.5, animations: {
self.frame = originalFrame
})
}, completion: nil)
只要註解視圖被添加到地圖,應用程序崩潰,但以下情況除外:
2016-09-25 19:32:58.655 MyApp 42[62332:4524529] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[UIView addKeyframeWithStartTime:duration:animations:] must be called inside the animations block of +[UIView animateKeyframesWithDuration:delay:options:animations:completion:]'
任何想法我做錯了什麼?
謝謝!
D'oh!我想我應該在將來更仔細地閱讀錯誤信息。 –