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!我想我应该在将来更仔细地阅读错误信息。 –