ios OC 截取当前屏幕返回图片

-(UIImage *)screenImageWithSize:(CGSize )imgSize{ UIGraphicsBeginImageContext(imgSize); 
CGContextRef context = UIGraphicsGetCurrentContext(); 
AppDelegate * app = (AppDelegate *)[UIApplication sharedApplication].delegate; 
[app.window.layer renderInContext:context]; 
UIImage * img = UIGraphicsGetImageFromCurrentImageContext(); 
UIGraphicsEndImageContext(); 
return img;}

你可能感兴趣的:(ios OC 截取当前屏幕返回图片)