如何从iPhone App中的URL读取.rtf文件 [英] How to read .rtf File from URL in iPhone App
问题描述
我的应用程序需要从URL读取.rtf文件.我将其阅读为
My app needs to read .rtf file from URL. I am going to read it as
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@.rtf",_URL]];
NSError* error;
NSString *content = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error];
现在,当我在UITextView中加载此文本时.它为我提供了带有{和/字符以及原始文件文本的标签.请指导我,我该如何阅读不包含任何方括号和html数据的正确文本.
Now when I load this text in UITextView. It gives me tags with { and / characters with the original file text. Please guide me that how can i read the right text which did not include any brackets and html data.
推荐答案
.rtf文件始终包含带有用于格式化文本颜色对齐和其他属性的标签..
.rtf file always contains Tags with itself for formating text color alignment and other properties..
请打开该.rtf文件以进行文本编辑,然后将该文件的所有文本部分转换为简单文本.
please open that .rtf file in to text edit and convert all text part of that file to simple text.
然后您现有的代码将可用.
then your existing code will work.
否则,而不是使UItextView在UIWebview中打开.
else instead of taking the UItextView open it in UIWebview.
希望对您有帮助.
这篇关于如何从iPhone App中的URL读取.rtf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!