无法将 CABasicAnimation 与 Mapbox iOS 框架一起使用
Cannot use CABasicAnimation with Mapbox iOS framework
我正在尝试在 MGLAnnotation
上使用 CABasicAnimation
或关键帧动画,但我找不到方法,因为 MGLAnnotation
不调用 "addAnimation"。
根据旧文档,可以使用 RMMarker
,但新版本中不存在此 class。
https://www.mapbox.com/mapbox-ios-sdk-legacy/examples/simple-cabasicanimation/
我创建了这样的 CABasicAnimation
对象:
let hover = CABasicAnimation(keyPath: "position")
hover.additive = true
hover.fromValue = NSValue(CGPoint: CGPointZero)
hover.toValue = NSValue(CGPoint: CGPointMake(0.0, -15.0))
hover.autoreverses = true
hover.duration = 1.0
hover.repeatCount = 500
hover.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
我无法将此动画添加到任何可能的 class。
有什么解决办法吗?
从 Mapbox iOS SDK v3.2.1 开始,动画注释并不容易。 MGLAnnotation 直接在 GL 级别渲染,不是 UIView 的子类,这意味着典型的 Core Animation 技术无法应用。
允许使用原生视图(例如,基于 UIView 的视图)作为注释是 v3.3.0 的计划功能。
我正在尝试在 MGLAnnotation
上使用 CABasicAnimation
或关键帧动画,但我找不到方法,因为 MGLAnnotation
不调用 "addAnimation"。
根据旧文档,可以使用 RMMarker
,但新版本中不存在此 class。
https://www.mapbox.com/mapbox-ios-sdk-legacy/examples/simple-cabasicanimation/
我创建了这样的 CABasicAnimation
对象:
let hover = CABasicAnimation(keyPath: "position")
hover.additive = true
hover.fromValue = NSValue(CGPoint: CGPointZero)
hover.toValue = NSValue(CGPoint: CGPointMake(0.0, -15.0))
hover.autoreverses = true
hover.duration = 1.0
hover.repeatCount = 500
hover.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
我无法将此动画添加到任何可能的 class。
有什么解决办法吗?
从 Mapbox iOS SDK v3.2.1 开始,动画注释并不容易。 MGLAnnotation 直接在 GL 级别渲染,不是 UIView 的子类,这意味着典型的 Core Animation 技术无法应用。
允许使用原生视图(例如,基于 UIView 的视图)作为注释是 v3.3.0 的计划功能。