实现流动效果划出的Tableview

动画效果
先上Demo:https://github.com/w11p3333/LLXAnimateTableview

主要实现:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
func animationTable() {

self.tableView.reloadData()

let cells = tableView.visibleCells
let tableHeight: CGFloat = tableView.bounds.size.height

for i in cells {
let cell: UITableViewCell = i as UITableViewCell
cell.transform = CGAffineTransformMakeTranslation(0, tableHeight)
}

var index = 0

for a in cells {
let cell: UITableViewCell = a as UITableViewCell
UIView.animateWithDuration(1.0, delay: 0.05 * Double(index), usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: [], animations: {
cell.transform = CGAffineTransformMakeTranslation(0, 0);
}, completion: nil)

index += 1
}
}

然后在viewWillAppear中调用它