Friday, 13 August 2010

Presenting Wordpress content?


background: app extension wordpress blog. downloads json containing blog articles, parses them individual articles (title, id, thumbnail, content) displays them in tableview. part works , looks nice.

problem: im looking looking way present articles when user taps 1 tableview. tuaw's or bgr's apps i'm stuck -_- keep article formatting intact possible.

libraries in use: sbjson, asihttprequest, sdwebimage


advice


heres code puts webview in use
code:
  - (void)loadmyarticledata  {      //create beginning of html string      nsmutablestring *html = [nsmutablestring stringwithstring: @"<html><head><title></title></head><body style=\"background:transparant;\">"];            // remove iframe junk wordpress has      nsstring *htmltext = [myarticle objectforkey:@"content"];      nsrange range1 = [htmltext rangeofstring:@"<iframe"];      nsrange range2 = [htmltext rangeofstring:@"</iframe>"];      if (range1.location != nsnotfound && 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:@"</body></html>"];            //make background transparent      [webview setbackgroundcolor:[uicolor clearcolor]];            nsurl *baseurl = [nsurl urlwithstring:@"http://leimobile.com"];            //pass string webview      [webview loadhtmlstring:[html description] baseurl:baseurl];  }  
heres content got json off wordpress
code:
  "content":"<!-- start shareaholic likebuttonsettop automatic --><!-- end shareaholic likebuttonsettop automatic --><p>the new app called <a href=\"http:\/\/click.linksynergy.com\/fs-bin\/click?id=zjtqkhrxauu&subid=0&offerid=146261.1&type=10&tmpid=3909&rd_parm0=http%3a%2f%2fitunes.apple.com%2fus%2fapp%2fbreathaleyes-bac-scanner%2fid477771569%3fmt%3d8&rd_parm1=http%3a%2f%2fitunes.apple.com%2fus%2fapp%2fbreathaleyes-bac-scanner%2fid477771569%3fmt%3d8\">breathaleyes<\/a> determines blood alcohol content level based on movements in eye. app detects rapid eye movement caused drinking , creators claim based on 40 years of research yet app “entertainment only.”<br \/>\nby detecting , analyzing horizontal gaze nystagmus (hgn), breathaleyes approximates subject’s blood alcohol content (bac). breathaleyes allows owner ability test @ anytime once downloaded onto smartphone. need friends , family make better informed decisions when drinking alcohol breathaleyes on smartphone , few seconds of time.<br \/>\n<a href=\"http:\/\/click.linksynergy.com\/fs-bin\/click?id=zjtqkhrxauu&subid=0&offerid=146261.1&type=10&tmpid=3909&rd_parm0=http%3a%2f%2fitunes.apple.com%2fus%2fapp%2fbreathaleyes-bac-scanner%2fid477771569%3fmt%3d8&rd_parm1=http%3a%2f%2fitunes.apple.com%2fus%2fapp%2fbreathaleyes-bac-scanner%2fid477771569%3fmt%3d8\">breathaleyes<\/a> cost $0.99 , available on app store now.<br \/>\n<object width=\"640\" height=\"360\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0\"><param name=\"allowfullscreen\" value=\"true\" \/><param name=\"allowscriptaccess\" value=\"always\" \/><param name=\"src\" value=\"http:\/\/www.youtube.com\/v\/smhqejs98ck&hl=en_us&feature=player_embedded&version=3\" \/><param name=\"allowfullscreen\" value=\"true\" \/><param name=\"allowscriptaccess\" value=\"always\" \/><embed width=\"540\" height=\"360\" type=\"application\/x-shockwave-flash\" src=\"http:\/\/www.youtube.com\/v\/smhqejs98ck&hl=en_us&feature=player_embedded&version=3\" allowfullscreen=\"true\" allowscriptaccess=\"always\" allowfullscreen=\"true\" allowscriptaccess=\"always\" \/><\/object><\/p>\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=http%3a%2f%2fleimobile.com%2fbreathaleyes-app-are-you-too-drunk-to-drive%2f&layout=standard&show_faces=true&width=300&height=25&action=like&font=arial&colorscheme=light\"  id=\"fblikeiframe\" name=\"fblikeiframe\"  scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\"  class=\"fblikecontainer\"  style=\"border:none; overflow:hidden; width:300px; height:25px; display:inline;\"  ><\/iframe><div class=\"shr-publisher-5467\"><\/div><!-- start shareaholic likebuttonsetbottom automatic --><div style=\"clear: both; min-height: 1px; height: 3px; width: 100%;\"><\/div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-googleplusone' data-shr_size='standard' data-shr_count='false' data-shr_href='http%3a%2f%2fleimobile.com%2fbreathaleyes-app-are-you-too-drunk-to-drive%2f' data-shr_title='breathaleyes+app%3a+are+you+too+drunk+to+drive%3f'><\/a><\/div><div style=\"clear: both; min-height: 1px; height: 3px; width: 100%;\"><\/div><!-- end shareaholic likebuttonsetbottom automatic -->"},"previous_url":"http:\/\/leimobile.com\/noaccsplash-updated-to-1-0\/","next_url":"http:\/\/leimobile.com\/breaking-apple-releases-ios-5-1-beta-3-to-developers\/"}  
i figured first youtube link out of content, strip junk out , add swapping correct link? i'm horrible @ stripping , manipulating strings much

code:
  <iframe id="yt" class="youtube-player" type="text/html" width="280" height="186" src="http://www.youtube.com/embed/smhqejs98ck" frameborder="0">  
 



Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment