【发布时间】:2016-11-05 20:34:43
【问题描述】:
snapshotViewAfterScreenUpdates
resizableSnapshotViewFromRect
drawViewHierarchyInRect
使用这些我想以任何格式拍照并需要发送。
【问题讨论】:
-
由于 iOS 应用是沙盒化的,因此您只能对自己的应用进行截图。
标签: ios api screenshot photo send
snapshotViewAfterScreenUpdates
resizableSnapshotViewFromRect
drawViewHierarchyInRect
使用这些我想以任何格式拍照并需要发送。
【问题讨论】:
标签: ios api screenshot photo send
试试这个
UIView *screenshotView = [[UIScreen mainScreen] snapshotViewAfterScreenUpdates:NO];
UIImage *snapshotImage = [self imageFromView:screenshotView];
- (UIImage *)imageFromView:(UIView *)view
{
UIGraphicsBeginImageContextWithOptions(view.bounds.size, YES, 0.0);
[view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
【讨论】: