Last active
October 16, 2017 13:26
-
-
Save titoaesj/81d9aa5214cd94444a1a79799dee7786 to your computer and use it in GitHub Desktop.
Criando animação nas células da UITableView - iOS
This file contains hidden or 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() { | |
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.5, delay: 0.05 * Double(index), usingSpringWithDamping: 0.8, initialSpringVelocity: 0, options: nil, 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