UIViewPropertyAnimator Objective C 问题

UIViewPropertyAnimation Objective C question

我正在关注 WWDC 2017,其中解释了如何使用 UIViewPropertyAnimationViewController 上管理 UIPanGesture

我的项目完全是 Objective C 而不是 Swift.

我想澄清一下这个 Swift 功能:

func animateTransitionIfNeeded(forState state: State, duration: TimeInterval) {
let blurAnimator = UIViewPropertyAnimator(duration: duration, dampingRatio: 1) { switch state {
        case .Expanded:
            self.blurEffectView.effect = UIBlurEffect(style: .dark)
        }
        case .Collapsed:
            self.blurEffectView.effect = nil
        }
    }
    blurAnimator.startAnimation()
    runningAnimators.append(blurAnimator)
}

在函数结束时调用:

runningAnimators.append(blurAnimator)

runningAnimators 在 objective C 中是 NSMutableArray 还是 NSDictionary?

抱歉这个愚蠢的问题。谢谢

它是 UIViewPropertyAnimator 个对象的数组。这可以是 "translated" 作为 NSMutableArray。您可以看到 .append 的使用,这是一种向 Swift.

中的数组添加元素的方法

检查 this link 了解更多信息。