Convert NSNotification.userInfo[UIKeyboardAnimationCurveUserInfoKey] to Enum

前端 未结 4 2121
失恋的感觉
失恋的感觉 2021-02-14 20:20

Using NSNumber from NSNotification.userInfo[UIKeyboardAnimationCurveUserInfoKey]

In Objective C I would do the following

 [UIView animateWithDuration:1.0         


        
相关标签:
4条回答
  • 2021-02-14 20:48

    Is this what you need?

    UIViewAnimationCurve.fromRaw(Int(hereGoesYourStuff))
    
    0 讨论(0)
  • 2021-02-14 20:50

    In Beta-5

    UIViewAnimationOptions.fromRaw(
        UInt(
            ( p.userInfo[ UIKeyboardAnimationCurveUserInfoKey ] as NSNumber ).unsignedIntValue << 16
        )
    )!
    
    0 讨论(0)
  • 2021-02-14 21:04
    let animationKey = userInfo[UIKeyboardAnimationCurveUserInfoKey] as UInt
    UIViewAnimationOptions(rawValue: animationKey)
    
    0 讨论(0)
  • 2021-02-14 21:14

    You have to init a UIViewAnimationOptions with the rawValue like this:

    UIView.animateWithDuration(1.0, delay: 0, options: UIViewAnimationOptions.init(rawValue:UInt(curveValue.intValue << 16)),

    0 讨论(0)
提交回复
热议问题