Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know the current UITableView cell position with respect to the UIViewController in swift 3.0?

How to know the current UITableView cell position with respect to the UIViewController in swift 3.0? In my case i m using a label on UITableViewCell with UITapGesture as per my requirement in Swift.

like image 971
Sunil kr singh Avatar asked Jan 04 '23 14:01

Sunil kr singh


1 Answers

This is done easily with convert(_ rect: CGRect, from view: UIView?). See more details here. So based on that, you can try this:

let rect = view.convert(tableView.rectForRow(at: indexPath), from: tableView)

Where view is your viewController's view and tableView is the table view containing the cell.

like image 188
Mihai Fratu Avatar answered Jan 07 '23 03:01

Mihai Fratu