Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c NSTextView不正确地显示基于HTML的属性字符串中的文本_Objective C_Cocoa - Fatal编程技术网

Objective c NSTextView不正确地显示基于HTML的属性字符串中的文本

Objective c NSTextView不正确地显示基于HTML的属性字符串中的文本,objective-c,cocoa,Objective C,Cocoa,我有以下文本: ❶可以添加为 上面的文本在文本编辑中显示良好。但当我尝试在NSTextView中显示相同内容时,会出现奇怪的字符- –可以添加为 下面是我用来在NSTextView中显示文本的代码 NSURL *url = < base URL >; NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML: data baseURL: url documentAttributes: (

我有以下文本:

❶可以添加为

上面的文本在文本编辑中显示良好。但当我尝试在NSTextView中显示相同内容时,会出现奇怪的字符-

–可以添加为

下面是我用来在NSTextView中显示文本的代码

NSURL *url = < base URL >;
NSAttributedString *attrString = [[NSAttributedString alloc]
    initWithHTML: data baseURL: url documentAttributes: (NSDictionary **) NULL];
[[textView textStorage] setAttributedString: attrString];
[attrString release];
NSURL*url=;
NSAttributedString*attrString=[[NSAttributedString alloc]
initWithHTML:databaseURL:url文档属性:(NSDictionary**)NULL];
[[textView textStorage]setAttributedString:attrString];
[字符串释放];
数据设置为-

data = NSData.FromString ("<html><head><style>p {font-size:14px;}</style></head><body><p>❶can be added </p></body></html>");
data=NSData.FromString(“p{font size:14px;}❶可添加

”;
数据的内容是什么?
data
是否指定XML或HTML字符编码?怎么样❶ 在
数据中编码
?第二个代码示例不是Objective-C。您使用的是什么语言?