我正在拍摄我视图区域的快照并将其设置为新的UIView。
UIView *currView = [self.view resizableSnapshotViewFromRect:mp.moviePlayer.view.frame afterScreenUpdates:YES withCapInsets:UIEdgeInsetsZero];
[currView setFrame:CGRectMake(0, 0, 204, 128)];
然后我尝试使用以下方法设置UIIamgeView图像:
[image2 setImage:[self getUIImageFromThisUIView:currView]];
-(UIImage*)getUIImageFromThisUIView:(UIView*)aUIView
{
UIGraphicsBeginImageContext(aUIView.bounds.size);
[aUIView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewImage;
}
但它没有将UIImageView的图像设置为任何东西? 提前致谢