Tôi đang cố gắng để animate chiều cao của hàng tableViewCell bằng cách gọi startAnimation() bên trong hàm tableView:Swift: Làm thế nào để animate rowHeight của một UITableView?
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!")
})
}
Kết quả: Chiều cao hàng không đổi nhưng không có bất kỳ hình ảnh động xảy ra. Tôi không hiểu tại sao hoạt ảnh không hoạt động. Tôi có nên định nghĩa một số trạng thái bắt đầu và kết thúc ở đâu đó không?