最初のステップは使用することです
CGRect rectInTableView = [tableView rectForRowAtIndexPath:indexPath];
これは、tableView内のセルのCGRectを報告します。ただし、この値はtableViewがスクロールしても変更されません。これは、テーブルの最初の行(最初に表示される行ではない)を基準にした位置です。画面上のセルの位置を取得するには、を使用してセルをスーパービュー座標系に変換する必要があります
CGRect rect = [tableView convertRect:rectInTableView toView:[tableView superview]];
したがって、次の行ですべてを実行します
CGRect rect = [tableView convertRect:[tableView rectForRowAtIndexPath:indexPath] toView:[tableView superview]];
スウィフト4
// Consider the indexPath at row 1, section 0.
let rectWithinTableView : CGRect = self.tableView.rectForRow(at: IndexPath(row: 1, section: 0))
let rectWithSuperViewCoordinates : CGRect = self.convert(rect: rectWithinTableView, to: self.tableView.superview)