+ (UIImage *) imageFromView: (UIView *) theView { // Draw a view’s contents into an image context UIGraphicsBeginImageContext(theView.frame.size); CGContextRef context = UIGraphicsGetCurrentContext(); [theView.layer renderInContext:context]; UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return theImage; }
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/3317.html