B.S.
B.S.

Reputation: 21726

How to get selected UITableViewCell's origin in the TableView?

As the tableView is scrolling it is difficult to know its current position on the screen by multiplication heightForRowAtIndex for all rows before selected.

Is there other way to get Y coordinate of selected tableViewCell in the tableView or in the screen? I try to get cell frame or bounds , but get (0,0,0,0) rectangle in didSelectRowAtIndexPath method.

Upvotes: 2

Views: 620

Answers (1)

Sven Tan
Sven Tan

Reputation: 1062

When the scrollView is scrolling, position of what on it is not changed, In fact is the content view moved.

Tableview is a kind of scrollview. You can get a property "contentOffset", that may help you.

Upvotes: 2

Related Questions