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

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -