【发布时间】:2015-01-07 11:00:00
【问题描述】:
我正在关注THIS 教程并使用此代码实现该动画:
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.layer.transform = CATransform3DMakeScale(0.1,0.1,1)
UIView.animateWithDuration(0.25, animations: {
cell.layer.transform = CATransform3DMakeScale(1,1,1)
})
}
但我想更新此单元格动画中的某些内容,例如当我滚动到 tableView 时,单元格在开始时像 (0.1,0.1,1) 一样小,之后它像 (1,1,1) 一样缩放,但我想像气泡类型效果一样应用开始时很小,之后它以 (1,1,1) 的原始比例出现,一个是缩放,然后再次进入其原始比例,如 (1,1,1)。
请指导我如何实现该动画?
编辑:
我试过了,但它不是那么顺利,也不是我想要的。
func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {
cell.layer.transform = CATransform3DMakeScale(0.1,0.1,1)
UIView.animateWithDuration(0.3, animations: {
cell.layer.transform = CATransform3DMakeScale(1,1,1)
})
UIView.animateWithDuration(1, animations: {
cell.layer.transform = CATransform3DMakeScale(2,2,2)
})
UIView.animateWithDuration(0.3, animations: {
cell.layer.transform = CATransform3DMakeScale(1,1,1)
})
}
【问题讨论】:
标签: uitableview animation swift