iOS捕捉屏幕截图

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

+ (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;
}