1.第一种
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, YES, 1.0f);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *uiImage = UIGraphicsGetImageFromCurrentImageContext();
2.第二种是私有方法,可能会不通过,也有人尝试提交成功的
CGImageRef img = UIGetScreenImage();
UIImage* uiImage=[UIImage imageWithCGImage:img];
3.获取视频截图
UIImage *uiImage = [moviePlayer thumbnailImageAtTime:moviePlayer.currentPlaybackTime
timeOption:MPMovieTimeOptionNearestKeyFrame];
本文介绍三种iOS平台上的截图方法:使用UIGraphicsBeginImageContextWithOptions进行视图截图;尝试使用私有方法UIGetScreenImage进行全屏截图;以及从AVPlayer中获取当前播放时间的视频帧作为缩略图。

977

被折叠的 条评论
为什么被折叠?



