2013-05-27 5 views
0

나는 RSS 피드 목록을 가지고 있으며 iPhone의 각 피드에 대한 세부 정보를 표시해야합니다. 나는 테이블 뷰에 표시하고있는 서버로부터 모든 RSS 피드를 얻었습니다. 이 포함됩니다, 나는 우리의 아이폰 UIHTML 내용을 표시하려면 어떻게iPhone에서 RSS 피드 표시`

<a href=\"http://timesofindia.indiatimes.com/articleshow/4881843.cms\"><img border=\"0\" hspace=\"10\" align=\"left\" style=\"margin-top:3px;margin-right:5px;\" src=\"http://timesofindia.indiatimes.com/photo/4881843.cms\" /></a>Cadila Pharmaceutical will seek the govt's nod in two days for initiating clinical trials for a vaccine against swine flu.<img width='1' height='1' src='http://timesofindia.feedsportal.com/c/33039/f/533968/s/1f181b11/mf.gif' border='0'/><div class='mf-viral'><table border='0'><tr><td valign='middle'><a href=\"http://share.feedsportal.com/viral/sendEmail.cfm?lang=en&title=Cadila+to+apply+for+clinical+trials+for+swine+flu+vaccine&link=http%3A%2F%2Ftimesofindia.indiatimes.com%2Farticleshow%2F4881843.cms\" target=\"_blank\"><img src=\"http://res3.feedsportal.com/images/emailthis2.gif\" border=\"0\" /></a></td><td valign='middle'><a href=\"http://res.feedsportal.com/viral/bookmark.cfm?title=Cadila+to+apply+for+clinical+trials+for+swine+flu+vaccine&link=http%3A%2F%2Ftimesofindia.indiatimes.com%2Farticleshow%2F4881843.cms\" target=\"_blank\"><img src=\"http://res3.feedsportal.com/images/bookmark.gif\" border=\"0\" /></a></td></tr></table></div><br/><br/><a href=\"http://da.feedsportal.com/r/133515347892/u/0/f/533968/c/33039/s/1f181b11/a2.htm\"><img src=\"http://da.feedsportal.com/r/133515347892/u/0/f/533968/c/33039/s/1f181b11/a2.img\" border=\"0\"/></a><img width=\"1\" height=\"1\" src=\"http://pi.feedsportal.com/r/133515347892/u/0/f/533968/c/33039/s/1f181b11/a2t.img\" border=\"0\"/>

- : 이제 행을 선택에 나는 HTML 내용 등의 서버에서 오는 RSS 피드의 discription를 표시해야 텍스트, 하이퍼 링크 및 이미지.

이 경우 UIWebview을 사용하는 것이 적절한 방법입니까? UIWebView은 중량입니다.

답변

0

다음과 같이 할 수 있습니다. ... 다음과 같은 flattenHTML 방법 쓰기에 이제 모든

descLbl.text=[self flattenHTML:descLbl.text];//descLbl.text is a text in which you are getting that HTML description... 

- (NSString *)flattenHTML:(NSString *)html { 

NSScanner *thescanner; 
NSString *text = nil; 

thescanner = [NSScanner scannerWithString:html]; 

while ([thescanner isAtEnd] == NO) { 

    [thescanner scanUpToString:@"<" intoString:NULL]; 

    // find end of tag 
    [thescanner scanUpToString:@">" intoString:&text]; 

    html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"\n"] withString:@" "]; 
    // replace the found tag with a space 
    //(you can filter multi-spaces out later if you wish) 
    html = [html stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@>", text] withString:@" "]; 

} // while // 

return html; 

} 

.. 내가 그 여부를 작동 알려

코딩 해피! !

0

HTML 엔티티를 그대로 표시하려는 경우 UIWebView과 함께 제안 할 것입니다. 당신은 loadHTMLString:

0

사용자가 콘텐츠를 웹 페이지로보기를 원한다면 UIWebView에 URL을로드하는 것이 가장 좋고 쉬운 방법입니다. 이처럼 :

UIWebView *webView = [[UIWebView alloc] init]; 
NSURL *pageurl = [NSURL URLWithString:http://www.google.com]; 
NSURLRequest *request = [NSURLRequest requestWithURL:pageurl]; 
[webView loadRequest:request]; 
0

당신은 단순히 RSSKit 라이브러리를 사용할 수 있습니다.