我想在视图的 uiwebview 框架中设置缩略图。但是,当我使用以下代码时,虽然图像值不为空,但没有显示图像。有人可以帮忙,让我知道我哪里出错了吗?
请注意,在代码中,VideoView 类是从 UIWebView 派生的,并且与它一样工作。
video = [[VideoView alloc]
initWithStringAsURL:@"http://www.youtube.com/watch?v=T6X3j7zxUHA"
frame:CGRectMake(11, 7, 298, 311)];
[self addSubview:video];
UIGraphicsBeginImageContext(video.bounds.size);
[video.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *resultImageView = UIGraphicsGetImageFromCurrentImageContext();
thumbnailButton = [UIButton buttonWithType:UIButtonTypeCustom];
[thumbnailButton setFrame:CGRectMake(0,0, 298, 311)];
[thumbnailButton setImage:resultImageView forState:UIControlStateNormal];
[video addSubview:thumbnailButton];
UIGraphicsEndImageContext();