【发布时间】:2016-06-04 04:13:48
【问题描述】:
我正在尝试通过在 tableView 函数中调用 startAnimation() 来为 tableViewCell 行的高度设置动画:
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!")
})
}
结果:行高确实发生了变化,但没有出现任何动画。我不明白为什么动画不起作用。我是否应该在某个地方定义一些开始和结束状态?
【问题讨论】:
标签: swift uitableview animation