Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplay wordpress post from JSON in iOS
    text
    copied!<p>Background: my app is an extension to a wordpress blog. It downloads a json containing the blog articles, parses them into individual articles (title, id, thumbnail, content) then displays them in a tableView. This part all works and looks nice.</p> <p>Problem: Im looking into a good looking way to present the articles when the user taps one from the tableView. I would like it too look something like TUAW's or BGR's apps but I'm stuck -_- I would also like to keep the article formatting as intact as possible.</p> <p>Libraries in use: SBJSON, ASIHTTPRequest, SDWebImage</p> <p>Any advice</p> <pre><code>- (void)loadMyArticleData { //create the beginning of the html string NSMutableString *html = [NSMutableString stringWithString: @"&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;/head&gt;&lt;body style=\"background:transparant;\"&gt;"]; // Remove the iframe junk that wordpress has NSString *htmlText = [myArticle objectForKey:@"content"]; NSRange range1 = [htmlText rangeOfString:@"&lt;iframe"]; NSRange range2 = [htmlText rangeOfString:@"&lt;/iframe&gt;"]; if (range1.location != NSNotFound &amp;&amp; range2.location != NSNotFound) { htmlText = [NSString stringWithFormat:@"%@%@", [htmlText substringToIndex:range1.location], [htmlText substringFromIndex:(range2.location+range2.length)]]; } // finish our html code [html appendString:htmlText]; [html appendString:@"&lt;/body&gt;&lt;/html&gt;"]; //make the background transparent [webView setBackgroundColor:[UIColor clearColor]]; NSURL *baseURL = [NSURL URLWithString:@"http://leimobile.com"]; //pass the string to the webview [webView loadHTMLString:[html description] baseURL:baseURL]; } </code></pre> <p>Heres an example post <a href="http://pastie.org/3161382" rel="nofollow">http://pastie.org/3161382</a> (Sorry, it would have been extremely ugly to post here)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload