【发布时间】:2021-10-20 07:42:17
【问题描述】:
我正在使用 didSelectRow at 方法为 tableView 单元格选择设置动画,该方法有效。我的代码如下:
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let cell = tableView.cellForRow(at: indexPath)
UIView.animate(withDuration: 0.2, animations: {
cell!.transform = CGAffineTransform(scaleX: 0.97, y: 0.97)
}, completion: { finished in
UIView.animate(withDuration: 0.2) {
cell!.transform = .identity
}
})
}
我希望能够将它放在单元格的自定义类文件中,但不知道从哪里开始。这可能吗?
谢谢
【问题讨论】:
标签: ios uitableview animation transform uiviewanimation