//截取当前屏幕的方法
- (UIImage *)getSnapshotImage {
UIGraphicsBeginImageContextWithOptions(CGSizeMake(CGRectGetWidth([UIScreen mainScreen].bounds), CGRectGetHeight([UIScreen mainScreen].bounds)), NO, 0.0);
[[(AppDelegate *)[UIApplication sharedApplication].delegate window] drawViewHierarchyInRect:CGRectMake(0, 0, CGRectGetWidth([UIScreen mainScreen].bounds), CGRectGetHeight([UIScreen mainScreen].bounds)) afterScreenUpdates:NO];
UIImage *snapshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return snapshot;
}
iOS 截取当前屏幕的方法
最新推荐文章于 2018-10-15 15:54:04 发布