您好,欢迎来到宝玛科技网。
搜索
您的当前位置:首页UIView.animateWithDuration 没有动画过渡效果直接跳到最后

UIView.animateWithDuration 没有动画过渡效果直接跳到最后

来源:宝玛科技网

当我在viewDidLoad()方法内添加以下代码的时候发现程序运行时不会有动画过度效果,而是直接跳到了最后。

        let x = (self.view.bounds.size.width - 268) / 2
        scanImage.frame = CGRectMake(x, 106, 268, 2)
        scanImage.contentMode = UIViewContentMode.ScaleAspectFill
        self.view.addSubview(scanImage)
        
        UIView.animateWithDuration(2, delay: 0, options: UIViewAnimationOptions.Repeat, animations: { () -> Void in
            self.scanImage.frame = CGRectMake(x,372, 268, 2)
        }, completion: nil)

 通过度娘后有网友说要把该代码块放到viewDidAppear(animated: Bool)方法内,试以一下果然有动画效果了。这到底是为什么啊?who can tell me why?

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- baomayou.com 版权所有 赣ICP备2024042794号-6

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务