facebook - swift NSValue.valueWithCGRect

标签 facebook animation swift facebook-pop

我正在尝试使用 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/

相关文章:

facebook - JS SDK 与 PHP SDK

facebook - 如何获取 Facebook 服务器时间?

IOS SWIFT : You have already authorized facebook ios

php - 是否可以通过graph api获取用户的所有组?

Swift 字典到字典数组

javascript - 使用 CSS/JS 在移动设备上创建向上滑动效果

c++ - Qt QWidget隐藏动画

javascript - jquery 背景动画与#anchor 冲突

ios - 无法使用参数列表调用方法 SnackbarWithMessage

ios - 基于另一个 UIpickerview 的 didSelectRow 返回 UIPickerview 中的 numberOfRowsInComponent 和 titleForRow