Swift: Como animar o rowHeight de um UITableView?
Estou tentando animar a altura das linhas tableViewCell chamando startAnimation () dentro da função tableView:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath) as! TableViewCell
tableView.rowHeight = 44.0
startAnimation(tableView)
return cell
}
//MARK: Animation function
func startAnimation(tableView: UITableView) {
UIView.animateWithDuration(0.7, delay: 1.0, options: .CurveEaseOut, animations: {
tableView.rowHeight = 88.0
}, completion: { finished in
print("Row heights changed!")
})
}
O resultado: a altura da linha muda, mas sem nenhuma animação. Não entendo por que a animação não funciona. Talvez eu deva definir algum estado inicial e final em algum lugar?