ファイルがあり.rtf
ます。の画像が含まれていますWindows Metafile Format(wmf)
。iOS
このファイルをアプリで表示したい。NSAttributedString
と inを使用して表示しようとしましUIWebView
たが、画像が表示されません。どうすればiOS
デバイスに表示できますか?
編集
の場合NSAttributedString
:
var urlpath = NSBundle.mainBundle().pathForResource("txtFile", ofType: "rtf")
var url:NSURL = NSURL.fileURLWithPath(urlpath!)!
if let attributedText = NSAttributedString(fileURL: url, options: [NSDocumentTypeDocumentAttribute:NSRTFTextDocumentType], documentAttributes: nil, error: nil) {
textView.attributedText = attributedText
}
の場合UIWebView
:
NSString *path = [[NSBundle mainBundle] pathForResource:@"txtFile" ofType:@"rtf"];
NSURL *url = [NSURL URLWithString:path];
[self.webView loadRequest:[NSURLRequest requestWithURL:url]];
EDIT2
.rtf
ファイルを.rtfd
ファイル形式に変換してみました。
RTFD ファイルは、ファイル内の画像とバンドルを作成TXT.rtf
します。TXT.rtf
ファイルでは、画像は参照として提供され、RTFD に個別に保存されます。次のように:
{{\NeXTGraphic img1.png \width40 \height20}¬}
ファイルを RTFD に変換しましたが、ファイルに.wmf
画像が含まれていると問題が発生します。.wmf
ファイル形式の画像が変換されません。