UIKit - UITableViewCell IndexPath 얻기
특정 UITableViewCell 객체의 IndexPath를 얻기 위해선 UITableView 객체의 indexPath(for:) 메서드를 통해 처리 가능함.
ViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
// MARK: - TodoCell Delegate
extension ViewController: TodoCellDelegate{
func completedButtonTapped(cell: TodoCell) {
guard let todo = cell.getTodoData() else { return }
...
guard let indexPath = tableView.indexPath(for: cell) else { return }
...
}
}
This post is licensed under CC BY 4.0 by the author.
