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
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:
while table view this:
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
Post a Comment