【发布时间】:2011-03-24 11:17:31
【问题描述】:
我有一个从 sqlite3 填充的 NSString 变量“body”。 字符串用 '\n' 和 '\t' 格式化,这样在 NSLog 中打印时看起来像
gagan
On 3/21/11 5:36 PM,
From:User91@SMODEVGWS03.com
To:"User91 Test"<User91@SMODEVGWS03.com>
Subject: test it
wrote:
ravan
~~~~~~~~~~~~~~~~
Attachment not downloaded due to unsupported type
我正在尝试将此字符串加载到 UIWebView 中,并且仍然保留我浏览并发现的所有格式。
NSString *body contains the above string with all the formatting.
NSData* data=[body dataUsingEncoding:NSUTF8StringEncoding];
if (data) {
[webView loadData:data MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:nil];
}
但我在 UIWebView 中看到格式没有保留,它变成了这样:
gagan On 3/21/11 5:36 PM,
From:User91@SMODEVGWS03.com
To:"User91 Test"<User91@SMODEVGWS03.com> Subject: test it wrote: ravan
~~~~~~~~~~~~~~~~Attachment not
downloaded due to unsupported type
谁能来救我?
【问题讨论】: