- + (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;
- }
来源: http://www.phpxs.com/code/1005435/