简体   繁体   English

Swift中的UIView.animateWithDuration-iOS7问题

[英]UIView.animateWithDuration in Swift - iOS7 issue

I am trying clear the data in a UITableView with some quick animation, I am using the below code, which works fine in iOS8. 我正在尝试使用一些快速动画清除UITableView中的数据,我正在使用以下代码,在iOS8中可以正常工作。

However when I run it on iOS7 it only runs the block after completion , but not the first animation code (fade out) , so the animation looks very bad, the tableview disappears suddenly and returns back with animation. 但是,当我在iOS7上运行它时,它只会在完成后运行该 ,而不会运行第一个动画代码(淡出) ,因此该动画看起来非常糟糕,表格视图突然消失并返回动画。

any idea what is wrong here? 知道这里有什么问题吗? what is the problem with it in iOS7? iOS7中的问题是什么?

    UIView.animateWithDuration (0.5,  animations: {

        self.tableView.transform = CGAffineTransformMakeScale(0.2, 0.2)
        self.tableView.alpha = 0

        }, completion: { (value: Bool) in

            UIView.animateWithDuration (0.5,  animations: {
                self.tableView.reloadData()
                self.tableView.transform = CGAffineTransformMakeScale(1.0, 1.0)
                self.tableView.alpha = 1
                println ("animation done")
            })
    })

尝试删除UIView.animateWithDuration(0.5,动画:{在完成代码块内检查并检查

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM