Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This app involves converting a book into an app. It has rich text (headings, bold, bullets, etc.) and instead of a page flip UI, it would be built in a split view controller. The master (left sidebar) would list chapters and bookmarks. The detail (right side) would have the chapter's contents and it would scroll down until the end of the chapter. Similar to Apple's Mail app on the iPad.

From my research, I can achieve the rich text by using HTML inside a UIWebView. What I'm not sure about is how to get bookmarks to work properly. Because there are no pages, the bookmark would need to be a vertical point in the chapter's content. For example, lets say the user reads half of Chapter 2, i.e. they have scrolled 50% of the way down. They could create a bookmark here.

My initial thoughts are to break the book's content up into "blocks", possibly paragraphs. For each chapter, in the detail view, use a UITableView. In each UITableViewCell, have a UIWebView with the HTML for each block. This way when the user creates a bookmark, we can store the cell's index path.

What would be the correct approach to this app?

share|improve this question
add comment

1 Answer

I have created the same kind of e-book once, called Afili Lugat.

My approach was using javascript method:

element.scrollTop

to get the scrollbar position and keep that position under a SQLite database with a name for the bookmark. For this e-book I struggled with font size because it was changeable. When a user changes the font size the scroll position was not correct anymore as the page length increases/decreases. So I was keeping the font size in the SQLite database. So I was loading the page, changing the font size and scroll the page to offset value that I was getting from element.ScrollTop using window.scrollBy(0,<offsetvalue>);

Hope this helps. Uygar

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.