Getting the exact location of a UITableViewCell
You could also use the rectForRowAtIndexPath
method to get the location of a UITableView
by sending the indexPath for that.
- (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath
So use as below:
CGRect myRect = [tableView rectForRowAtIndexPath:indexPath];
Apart from rectForRowAtIndexPath you need to consider the scrolling.
Try this code:
// Get the cell rect and adjust it to consider scroll offset
CGRect cellRect = [tableView rectForRowAtIndexPath:indexPath];
cellRect = CGRectOffset(cellRect, -tableView.contentOffset.x, -tableView.contentOffset.y);