ios - How can I get the frame of a table view cell in the coordinate space of the table view? -


i have table view bunch of cells in it. want frame of cell, not in superview's coordinate space, in table view's coordinate space.

a picture explain better

enter image description here

see red rectangle? frame of table cell. , blue rectangle frame of table view. want red rectangle relative blue rectangle.

i tried use frame property of uitableviewcell. doesn't work because returns (0, 0, 320, 44). y value shouldn't 0 because cell not @ top of screen.

according view hierarchy, intended behaviour, because superview of table cell apparently uitableviewwrapperview, not table view:

enter image description here

while table view this:

enter image description here

so there method/property can me cgrect represents frame of table view cell in coordinate space of table view?

i think there function can convert cgrect in coordinate space another. forgot name , how use it. don't know whether helpful in situation.

please use below code

let rectofcell= tableview.rectforrowatindexpath(indexpath) let rectofcellinsuperview = tableview.convertrect(rectofcell, toview: tableview.superview) 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -