Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // метод делегата ячейки (вызывется при тапе на view ячейки) CustomTableViewCell
- // вариант №1 (анимация не проигрывается, хотя программа в метод успешно cell.launchAnimation() заходит)
- func didTapOnTableViewCellView(sender: CustomTableViewCell) {
- guard let indexPath = tableView.indexPath(for: sender) else {
- return
- }
- guard let cell = tableView.cellForRow(at: indexPath) as? CustomTableViewCell else {
- return
- }
- CATransaction.begin()
- CATransaction.setCompletionBlock({
- cell.launchAnimation()
- })
- tableView.beginUpdates()
- tableView.reloadRows(at: [indexPath], with: .none)
- tableView.endUpdates()
- CATransaction.commit()
- }
- // вариант №2 (анимация проигрывается)
- func didTapOnTableViewCellView(sender: CustomTableViewCell) {
- guard let indexPath = tableView.indexPath(for: sender) else {
- return
- }
- guard let cell = tableView.cellForRow(at: indexPath) as? CustomTableViewCell else {
- return
- }
- cell.launchAnimation()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement