0

I'm trying to create an small app for a wordpress blog. For doing this i figured that i would make a webservice which convert the post_title and post_content of the mysql table to an json object and then use AFNetworking for the requests.

The problem is that the post_content is an html string like:

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

 

<a href="http://URL/wordpress/wp-content/uploads/2014/04/Digital-Board-2.png"><img class="alignnone size-full wp-image-5" src="http://URL/wordpress/wp-content/uploads/2014/04/Digital-Board-2.png" alt="Digital Board 2" width="1024" height="704" /></a>

I've tried by putting this into an UIWebView, but this does not fit probably since pictures is way bigger than the screen.

I'm wondering what are the right way to do this, so i can customize text and images correctly.

I'm thinking wether you can put all of it into an array and then split by url or something. So it would look something like this:

Array = [Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!], [http://URL/wordpress/wp-content/uploads/2014/04/Digital-Board-2.png]

Is this possible? and if yes how can i do this?

I'm open for better ways.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
user3423384
  • 667
  • 2
  • 8
  • 18
  • Are the answers always of the same type/structure? If yes, you could do a custom `UIView` to manage them (with a `UILabel`, an `UIImageView`, etc.). Else, your could also use a `NSRegularExpression` looking for modifying the `width="XxX" height="XxX"` values. – Larme Apr 19 '14 at 10:27

1 Answers1

0

You could DTCoreText use if you wish to view such blog content. But if you need more freedom in the design, look at DTFoundation. The framework DTFoundation there is a HTMLParser of you a lot of work decreases.

Mirko Brunner
  • 2,204
  • 2
  • 21
  • 22
  • i've integrated the DTCoreText now. Which will show a lot of data from the html code. This will print thisinto my DTAttributedTextView: ( "Welcome to WordPress. This is your first post. Edit or delete it, then start blogging! \n \nĀ  \n \n. How can i remove (" and make nextline instead of \n? – user3423384 Apr 19 '14 at 19:00
  • Hmm. Before you fill the content in your TextView yes you can replace the "\ n" with "
    " with `- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement`. Here is an example: http://stackoverflow.com/questions/668228/string-replacement-in-objective
    – Mirko Brunner Apr 19 '14 at 22:12