【发布时间】:2010-10-07 08:58:59
【问题描述】:
我捕获了播放 Flash 的 webview 图像。因为我想展示这张图片,并使用IKSaveOptions来保存图片。但是我发现图片的路径是nil,现在我想获取图片的路径,怎么办? 我的代码: NSString *path = [[NSBundle mainBundle] pathForResource: ?? ofType:??]; NSURL *url = [NSURL fileURLWithPath: path]; 然后我使用url在imageview中显示图像,但是现在我没有得到路径,非常感谢!
非常感谢。现在我认为 NSBundle 不是我的选择。但我想显示从显示闪光灯的 web 视图中捕获它的图像。我可以在 imagecell 中显示它,但在 imageview 中显示,我使用代码:
[imageView setImage:image imageProperties: mImageProperties];
并且 mImageProperties 来自你带我的 ImageKit 文档的文档,名称是“Viewing an Image in an Image View”,其中 mImageProperties 是 image 的属性。代码是:
mImageProperties = (NSDictionary*)CGImageSourceCopyPropertiesAtIndex(isr, 0, (CFDictionaryRef)mImageProperties);
仍然使用图像的url,如果我不能使用 NsBundle ,我该如何获取图像的属性,顺便说一下,我已经获得了显示flash的捕获webview的图像.代码:
NSBitmapImageRep *imageRep = [webView bitmapImageRepForCachingDisplayInRect:[webView frame]]; [webView cacheDisplayInRect:[webView frame] toBitmapImageRep:imageRep]; NSImage *image = [[NSImage alloc] initWithSize:[webView frame].size]; [图片添加表示:imageRep];
【问题讨论】:
标签: cocoa