i working on ios application in taking clear screen shot required i've tried
func captureview() -> uiimage { //hide controls if needed let rect: cgrect = self.imageview.frame uigraphicsbeginimagecontext(rect.size) let context: cgcontextref = uigraphicsgetcurrentcontext()! self.view.layer.renderincontext(context) let img: uiimage = uigraphicsgetimagefromcurrentimagecontext() uigraphicsendimagecontext() return img }
but quality of image not good. please suggest me it.
change line
uigraphicsbeginimagecontext(rect.size)
to
uigraphicsbeginimagecontextwithoptions(rect.size, false, 0.0);
Comments
Post a Comment