ios - Prolem with converting point from table cell -
i have following hierarchy: controller.view [tableview, overlayview]. table view has top inset of 16 points parent view via constraint, overlay view - not.
inside table cell content view have view responder
, want show it's image on view overlayview
.
if use code (inside overlay view):
cgrect frame; cgpoint origin = [responder convertpoint:responder.frame.origin toview:self]; // fixme origin.y -= 16; frame.origin = origin; frame.size = responder.frame.size; _imageview.frame = frame; uigraphicsbeginimagecontextwithoptions(responder.bounds.size, no, 0); [responder drawviewhierarchyinrect:responder.bounds afterscreenupdates:yes]; _imageview.image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
i imageview
16 points offset responder
origin , image not fit original view. have use line fixme mark have origin points equal. why converting don't work?
you should converting point responder
's superview
, not responder
itself. change second line this:
cgpoint origin = [responder.superview convertpoint:responder.frame.origin toview:self];
Comments
Post a Comment