I want to set thumbnail image in the uiwebview frame on my view. However when I use the following code, there is no image displayed, although the image value is NOT NULL. Can someone help and and let me knwo where am I going wrong?
Please note that in the code, the VideoView class is derived from UIWebView and works just like it.
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();