views:

301

answers:

1

Hi guys! I'm developing EPUB reader on iPad. So, I got a problem. We know that EPUB is not a paged format. But, I want to show it page by page. Of course, it will be more pages if font size is larger, it will be less pages if font size is smaller.

I want to make it like iBooks. How to solve it?

Thank you for attention.

A: 

You're going to have to read in the data and lay out the text according to whatever rules you set up. As far as I know, there's no built-in facility for paging content in UIKit's text controls.

One thing you might try is to use a web view to display your content via HTML on a page-by-page basis. You can use Javascript to grab metrics on a page and gradually add or remove content from the page until it matches your metrics. Do it in a separate thread and have it analyze the EPUB while the user is reading the first page. As an added bonus, that would enable you to use CSS to do your page layout, which would give you some nice control over typography, line spacing, etc., while making it easy to add features like hotlinked tables of contents.

cc