ios - How to take snapshot of app running on simulator? -
i used code take snapshot of app running on simulator, quality of snap not good, idea?
-(ibaction)btnsave:(id)sender { uigraphicsbeginimagecontextwithoptions(self.view.bounds.size,self.view.opaque,10.0f); [self.view.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage * screenshot = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); /* render screen shot @ custom resolution */ cgrect croprect = cgrectmake(0,0,320,500); uigraphicsbeginimagecontextwithoptions(croprect.size,brochuresave.opaque,10.0f); [screenshot drawinrect:croprect]; uiimage * customscreenshot = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); /* save photo album */ // uiimagewritetosavedphotosalbum(customscreenshot , nil, nil, nil); [self.library saveimage:customscreenshot toalbum:@"cemara roll" withcompletionblock:^(nserror *error) { if (error!=nil) { nslog(@"big error: %@",[error description]); } else { uialertview *alert=[[uialertview alloc] initwithtitle:@"message" message:@"image save cemara roll" delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil]; [alert show]; } }]; }
try changing 10.0f
0.0f
in uigraphicsbeginimagecontextwithoptions
:
here:
uigraphicsbeginimagecontextwithoptions(self.view.bounds.size,self.view.opaque,0.0f);
Comments
Post a Comment