The first step is to use
CGRect rectInTableView = [tableView rectForRowAtIndexPath:indexPath];
which will report the CGRect of a cell within the tableView. However, this value does not change as the tableView scrolls. It is the position relative to the first row of the table (and not the first visible row). To get the position of the cell on the screen you have to convert it to the superviews coordinate system using
CGRect rect = [tableView convertRect:rectInTableView toView:[tableView superview]];
So the following line does it all
CGRect rect = [tableView convertRect:[tableView rectForRowAtIndexPath:indexPath] toView:[tableView superview]];
Swift 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)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…