Given a UITableView
, how can I find the location of a specific UITableViewCell
? In other words, I want to get its frame relative to my iPhone screen, n
try it in
didSelectRowAtIndexPath
method
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
// get current location of selected cell
CGRect rectInTableView = [tableView rectForRowAtIndexPath:indexPath];
CGRect rectInSuperview = [tableView convertRect:rectInTableView toView:[tableView superview]];
NSLog(@"Cell Y Is %f",rectInSuperview.origin.y);
NSLog(@"Cell X Is %f",rectInSuperview.origin.x);