【发布时间】:2010-07-01 11:41:49
【问题描述】:
我想创建 UIWebView 的 UIImage,然后我想绘制该图像。
这是我的代码:
UIView *tempView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 768, 1004)];
tempView.backgroundColor = [UIColor blueColor];
UIGraphicsBeginImageContext(tempView.bounds.size);
[tempView drawRect:tempView.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
CGRect imageRect = CGRectMake(0, 0, image.size.width, image.size.height);
CGContextDrawImage(ctx, imageRect, [image CGImage]);
但它除了空白页之外没有绘制任何东西。我们不能像那样创建 UIImage 还是我在代码的某个地方做错了什么。
感谢
【问题讨论】: