Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Вариант №1 (анимация не работает)
- func didTapOnCustomTableViewCell(sender: CustomTableViewCell) {
- guard let indexPath = tableView.indexPath(for: sender) else {
- return
- }
- CATransaction.begin()
- CATransaction.setCompletionBlock({ [weak self] in
- guard let indexPath = self?.tableView.indexPath(for: sender) else {
- return
- }
- guard let cell = self?.tableView.cellForRow(at: indexPath) as? CustomTableViewCell else {
- return
- }
- cell.launchAnimation()
- })
- tableView.beginUpdates()
- tableView.reloadRows(at: [indexPath], with: .none)
- tableView.endUpdates()
- CATransaction.commit()
- }
- // Вариант №2 (а так работает!!!) Спасибо!
- func didTapOnCustomTableViewCell(sender: CustomTableViewCell) {
- guard let indexPath = tableView.indexPath(for: sender) else {
- return
- }
- CATransaction.begin()
- CATransaction.setCompletionBlock({ [weak self] in
- // guard let indexPath = self?.tableView.indexPath(for: sender) else {
- // return
- // }
- guard let cell = self?.tableView.cellForRow(at: indexPath) as? CustomTableViewCell else {
- return
- }
- cell.launchAnimation()
- })
- tableView.beginUpdates()
- tableView.reloadRows(at: [indexPath], with: .none)
- tableView.endUpdates()
- CATransaction.commit()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement