如何以編程方式在IOS上截圖我想要一個屏幕上的圖片截圖保存到保存的照片庫。
3 回答
慕標琳琳
TA貢獻1830條經驗 獲得超9個贊
//iOS7 or above- (UIImage *) screenshot {
CGSize size = CGSizeMake(your_width, your_height);
UIGraphicsBeginImageContextWithOptions(size, NO, [UIScreen mainScreen].scale);
CGRect rec = CGRectMake(0, 0, your_width, your_height);
[_viewController.view drawViewHierarchyInRect:rec afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;}- 3 回答
- 0 關注
- 407 瀏覽
添加回答
舉報
0/150
提交
取消
