关于iOS屏幕截图的,网络上有好多,但好多都表示如果播放视频截图的话,截的是黑的。
刚好目前有这需求,然后就各种搜索。解决办法如下:(主要是加粗的那句)
snapshotView.frame = CGRectMake(0, 0, _videoPlayBackView.frame.size.width, _videoPlayBackView.frame.size.height);
UIGraphicsBeginImageContext(_videoPlayBackView.frame.size);
[_videoPlayBackView drawViewHierarchyInRect:_videoPlayBackView.bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
网友评论