【发布时间】:2011-02-23 12:46:04
【问题描述】:
我有这个代码-
/** 将 Web 视图另存为屏幕截图。目前只支持保存到 照片库。 / - (void)saveScreenshot:(NSArray)arguments with Dict:(NSDictionary*)options { CGRect screenRect = [[UIScreen mainScreen] bounds]; CGRect imageRect = CGRectMake(0, 0, CGRectGetWidth(screenRect), CGRectGetHeight(screenRect));
UIGraphicsBeginImageContext(imageRect.size);
[webView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(viewImage, self, nil, nil);
UIAlertView *alert= [[UIAlertView alloc] initWithTitle:nil
消息:@“图像已保存”委托:self cancelButtonTitle:@“确定” 其他按钮标题:无]; [警报显示]; [警报发布];
}
这是为了保存您在我的应用中绘制的任何内容。我将如何在 HTML 代码中为此添加按钮。我如何调用它?
【问题讨论】:
标签: javascript iphone objective-c