屏幕截图的方法
不用 2d截圖 ? 直接截圖
1 -(UIImage *)screenShots 2 { 3 //截取整個backview 4 UIGraphicsBeginImageContext(self.backgroundView.bounds.size); 5 [self.backgroundView.layer renderInContext:UIGraphicsGetCurrentContext()]; 6 UIImage *sourceImage = UIGraphicsGetImageFromCurrentImageContext(); 7 UIGraphicsEndImageContext(); 8 9 //在截圖上畫下自己需要的位置及大小 10 UIGraphicsBeginImageContext(self.mainContentView.frame.size); 11 [sourceImage drawAtPoint:CGPointMake(0, self.mainContentView.bounds.size.height - self.view.bounds.size.height)];13 UIImage * image = UIGraphicsGetImageFromCurrentImageContext(); 14 UIGraphicsGetCurrentContext(); 15 16 return image; 17 }?
轉載于:https://www.cnblogs.com/jw-blog/p/5106150.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
- 上一篇: 通过练习题学习磁盘知识
- 下一篇: python windows下的file