iOS截取屏幕(屏幕截图)

华欣荣
2023-12-01


-(UIImage*)printscreen
{
    //以下是实现截屏功能
    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, self.view.opaque, 0.0);
    [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
    
    UIImage * jieTuImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return jieTuImage;
}






 类似资料: