Codoon should stick to writing things to prevent the speed of the bald roof from accelerating!
I will start with this in 2104. I haven't written it for a long time. It's decadent...
//
-(UIImage *) captureCurrentView :( UIView *) view {
CGRect frame = view. frame;
UIGraphicsBeginImageContext (frame. size );
CGContextRef contextRef = UIGraphicsGetCurrentContext ();
[View. layerrenderInContext: contextRef];
UIImage * image = UIGraphicsGetImageFromCurrentImageContext ();
UIGraphicsEndImageContext ();
UIImage * saveImage = [UIImageimageWithCGImage: CGImageCreateWithImageInRect (image. CGImage, CGRectMake (, self. view. frame. size. width, self. view. frame. size. height)];
Return saveImage;
}
// Save the image
-(Void) saveImageToPhotos :( UIImage *) image {
UIImageWriteToSavedPhotosAlbum (image, self, @ selector (image: didFinishSavingWithError: contextInfo :), NULL );
}
// Save the callback
-(Void) image: (UIImage *) image didFinishSavingWithError: (NSError *) error contextInfo: (void *) contextInfo
{
NSString * msg = nil;
If (error! = NULL ){
Msg = @ "failed to save the image ";
} Else {
Msg = @ "image saved ";
}
}