简体   繁体   中英

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.

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.

any idea what is wrong here? what is the problem with it in 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,动画:{在完成代码块内检查并检查

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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