uikit - How to capture UIView to UIImage without loss of quality on retina display -


my code works fine normal devices creates blurry images on retina devices.

does know solution issue?

+ (uiimage *) imagewithview:(uiview *)view {     uigraphicsbeginimagecontext(view.bounds.size);     [view.layer renderincontext:uigraphicsgetcurrentcontext()];      uiimage * img = uigraphicsgetimagefromcurrentimagecontext();      uigraphicsendimagecontext();      return img; } 

switch use of uigraphicsbeginimagecontext uigraphicsbeginimagecontextwithoptions (as documented on page). pass 0.0 scale (the third argument) , you'll context scale factor equal of screen.

uigraphicsbeginimagecontext uses fixed scale factor of 1.0, you're getting same image on iphone 4 on other iphones. i'll bet either iphone 4 applying filter when implicitly scale or brain picking on being less sharp around it.

so, guess:

#import <quartzcore/quartzcore.h>  + (uiimage *) imagewithview:(uiview *)view {     uigraphicsbeginimagecontextwithoptions(view.bounds.size, view.opaque, 0.0);     [view.layer renderincontext:uigraphicsgetcurrentcontext()];      uiimage * img = uigraphicsgetimagefromcurrentimagecontext();      uigraphicsendimagecontext();      return img; } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -