相机截图的代码

在相机的页面实现,截图,话不多说,直接上代码

-(UIImage*)captureView:(UIView *)theView{

    UIGraphicsBeginImageContext(CGSizeMake(theView.size.width, theView.size.height));

    [theView drawViewHierarchyInRect:CGRectMake(0, 0,theView.size.width, theView.size.height) afterScreenUpdates:NO];

    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();

    UIGraphicsEndImageContext();

    return img;

}

你可能感兴趣的:(相机截图的代码)