视频播放时如何截屏?我使用 MPMoviePlayerController 进行视频播放。
问问题
1120 次
1 回答
4
- (UIImage *) captureScreen
{
UIWindow *keyWindow = [[UIApplication sharedApplication] keyWindow];
CGRect rect = [keyWindow bounds];
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[keyWindow.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
于 2012-06-29T06:54:06.950 回答