Created
February 24, 2016 06:40
-
-
Save wleii/93d7ce78a476ecb309b5 to your computer and use it in GitHub Desktop.
A Simple TableViewCell Appear Animation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewWillAppear(animated: Bool) { | |
animateTable() | |
} | |
func animateTable() { | |
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 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment