0

I am currently working on the reader app for one of Wordpress blogs. With the help of those two posts I've gone quite far:

How Can I Incorporate my WordPress Blogs into an iOS app? Wordpress Blog iPhone App Reader

But now I am struggling with a question if it is actually would be possible to show the post in native view instead of just loading an html code inside UIWebView? I can get everything I need to recreate the post: text, headers, images, video urls, but the question is how to recreate the structure of the post? So how can I know how textual information and images are located relatively to each other inside the post?

I am using https://github.com/topfunky/hpple to parse HTML files inside the app.

Many thanks in advance!

Community
  • 1
  • 1
palatov
  • 1
  • 2

1 Answers1

0

I think one way of doing this is that you create a JSON feed for your blog and use this feed to build native UI using UItableView etc.

https://wordpress.org/plugins/feed-json/
Zee
  • 1,865
  • 21
  • 42
  • Hi Zee, thanks for your respond. I am already using this JSON plugin to display a feed in a collection view. Each cell is a post preview, with title, thumbnail and a short description. Then when you are tapping on on of the cells it opens a corresponding blog post. So, my problem is that I can not figure out how to display this post in other way then UIWebView. – palatov Jun 05 '14 at 08:07
  • If you are able to fetch the text out that html, you can display it on a ViewController (a totally customised view). Otherwise you will have to use UIWebViews (which isn't a bad idea as well). – Zee Jun 05 '14 at 08:35
  • Exactly, I can fetch text and all image urls, and of course can display them in UIView, but the problem is that I can not recreate the structure of the post. So lets say if post looks like: HEADER - IMAGE - SUBHEADER - IMAGE - TEXT - ANOTHER IAMGE - TEXT , I can fetch all this elements, but how can I put them in UIView accordingly? – palatov Jun 05 '14 at 08:46
  • If the layout of the post is not consistent, you should use webview or may be mixed approach. – Zee Jun 05 '14 at 08:48
  • Yeah,UIWebView seems to be only one solution now. But what I would like to accomplish is a sort of algorithm which scans the html code and makes guide-marks, like ok - here is a header, and then there is an article text, there is an image and so on. Do not where to start though, stuck in research phase. – palatov Jun 05 '14 at 09:37