ios - Objective C / Drawing and resolution questions -


i need create calendar of image (they size 640 x 960 or 960 x 640). 1 approach tried create view, add image view it, present image, "draw" on subviews, save view file.

now works planned, testing in simulator, resolution of saved image 306 x 462 (size of view i'm saving). lost half original resolution...

is there way work around this?

code saved view:

uigraphicsbeginimagecontext(self.backgroundimageview.bounds.size); [self.backgroundimageview.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *image = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext();  nsarray * paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring * basepath = ([paths count] > 0) ? [paths objectatindex:0] : nil;  nsstring *fullpath = [nsstring stringwithformat:@"%@/calendar.png",basepath]; nsdata * binaryimagedata = uiimagepngrepresentation(image);  [binaryimagedata writetofile:fullpath atomically:yes]; 

you're not accounting device screen scale, should it: uigraphicsbeginimagecontextwithoptions(self.backgroundimageview.bounds.size, yes, [uiscreen mainscreen].scale);.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -