3

I would like to hear your advice in the following:

I would like to display to the user information which contain both formatted text and images. Ideally this would be stored in an SQLite db.

I know I can use UIWebview to load Html formatted files from a db, but what about images? Adding the images i want to use as files to my project doesnt sound like a good approach.

So, any suggestions?

Tassos Voulgaris
  • 878
  • 1
  • 9
  • 21

1 Answers1

2

If it comes to formatting text and images in all the nice and various ways you can imagine the webview is unparalleled. You can go into the deep dark pit called CoreText to make text look awesome, however handling images and the flow of text around those will be alot of work.

HTML in combination with CSS will give you a highly flexible and maintainable basis to display text in combination with images.

In your sqlite you'll likely save your text as html and style it with css. You can add the images to your bundle and reference those from your webviews.

EDIT: You may also save the text in your db in any structure you like: articles, paragraphs, elements whatever you imageine. Create your own small html processor which glues all the pieces and transfer it into a nice html resource which you load with your webview.

Some links to get you started with the webview and your images:

Community
  • 1
  • 1
Nick Weaver
  • 47,228
  • 12
  • 98
  • 108
  • How this would work, image wise, for my project when I have thousands of different articles to display? Just like it would in a web site I suppose, right? Are there any other solutions, like e.g. html with embedded images? – Tassos Voulgaris Feb 29 '12 at 19:15
  • @Tassos Voulgaris That's what I meant: Your articles have to reference your images like you would on a webpages. Actually it is a webpage but you won't load the images from a distant server but from your bundle. Have a look at the links I just added. With this approach you can even reuse images which are the same in different articles. – Nick Weaver Feb 29 '12 at 19:17
  • I dont think you answered his inital question properly, I think he was looking to have embeded images maybe mime encoded in which he was woundering how to load them.... – HurkNburkS Aug 25 '13 at 23:45
  • @HurkNburkS pretty old question with vague requirements at least not enough detail to answer in a concise way. Give it a shot please. – Nick Weaver Aug 26 '13 at 08:52