ios - How to capture a UIView as image which is out of currently visible frame? -
is there way capture uiview uiimage not visible or out of frame. below code using now:
uigraphicsbeginimagecontextwithoptions(_myview.bounds.size, _myview.opaque, 0.0f); [theview drawviewhierarchyinrect:_myview.bounds afterscreenupdates:no]; uiimage * snapshotimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();
try this-
-(uiimage *)imagefromview:(uiview *)myview{ uigraphicsbeginimagecontextwithoptions(myview.bounds.size, myview.opaque, [uiscreen mainscreen].scale); [myview.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage * image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return image; }
Comments
Post a Comment