I have a reader app that loads .epub
files and usually I have no problem with selection at all, lately I have integrated fixed layout .epub
files but I'm facing a problem: when I have a box containing one line the selection works fine, but when the box contains several lines, meaning several <p></p>
, I cannot select a single word from the box. On selection the whole box gets selected as shown in the screenshot. When I try the same .epub
file on iBooks, the selection works fine on all text. Any idea how I can fix the issue?
Here is the code for loading the file on UiWebView
.
NSString *contents = [NSString stringWithContentsOfFile:itemPath encoding:NSUTF8StringEncoding error:nil];
if (!contents) {
contents = [NSString stringWithContentsOfFile:itemPath encoding:NSASCIIStringEncoding error:nil];
}
[readingWebView loadHTMLString:contents baseURL:baseURL];
I have finally got the answer.
When using this function:
to set the font size some restrictions are set on the web view, one of them is related to the selection with fixed layout epubs.
I used instead: