我正在尝试使用 Facebook pop POPSpringAnimation 为 UIButton 的边界设置动画,但我找不到我应该在 swift 中使用什么来替换 NSValue.valueWithCGRect
这就是我想要做的:
@IBAction func buttonTapped(sender : UIButton) {
var springAnimation = POPSpringAnimation()
springAnimation.property = POPAnimatableProperty.propertyWithName(kPOPLayerBounds) as POPAnimatableProperty
springAnimation.springBounciness = 12.0
springAnimation.springSpeed = 10.0
springAnimation.toValue = NSValue.valueWithCGRect(newBounds)
shutterButton.pop_addAnimation(springAnimation, forKey: "size")
}
最佳答案
这将编译:
let rect = CGRect(x: 0,y: 0,width: 1,height: 1)
let val = NSValue(CGRect: rect)
这是“初始化语法”
关于facebook - swift NSValue.valueWithCGRect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24150240/