
这是我想要应用于UIVIEw.animateWithDuration的示例简易:
let ease = @R_404_2340@Function(controlPoints: float(0.8),float(0.0),float(0.2),float(1.0))
我尝试制作自己的UIVIEwAnimationCurve,但它似乎只接受一个Int.
我可以将自定义缓动应用于Core Animation,但我希望为UIVIEw.animateWithDuration自定义缓动以获得更简单和优化的代码. UIVIEw.animateWithDuration对我来说更好,因为我不必为每个动画属性和更容易的完成处理程序定义动画,并且在一个函数中包含所有动画代码.
到目前为止,这是我的非工作代码:
let customOptions = UIVIEwAnimationoptions(UInt((0 as NSNumber).integerValue << 50))UIVIEw.setAnimationCurve(UIVIEwAnimationCurve(rawValue: 5)!)UIVIEw.animateWithDuration(2,delay: 0,options: customOptions,animations: { vIEw.layer.position = toposition vIEw.layer.bounds.size = toSize },completion: { finished in println("completion")})解决方法 这是因为UIVIEwAnimationCurve是一个枚举 – 它基本上是人类可读的整数值表示,用于确定要使用的曲线. 如果要定义自己的曲线,则需要使用CA动画.
您仍然可以执行完成块和动画组.您可以将多个CA动画分组到CAAnimationGroup中
let theAnimations = CAAnimationGroup()theAnimations.animations = [positionAnimation,someOtherAnimation]
完成后,使用CATransaction.
CATransaction.begin()CATransaction.setCompletionBlock { () -> VoID in // something?}// your animations go hereCATransaction.commit() 总结 以上是内存溢出为你收集整理的ios – animateWithDuration中的自定义缓动?全部内容,希望文章能够帮你解决ios – animateWithDuration中的自定义缓动?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)