0

I have created an app to read ePub files as @Euan's post

Reading ePub format

Epub files may contains image as well as text. Images are look like icon. I want to show the images in maximized manner when we tap the image in the ePub file. how can i do this. Help me

Thanks in advance.

Have a nice day.

Community
  • 1
  • 1
Balamurugan
  • 117
  • 5
  • Hi guys, I got answer to my query from the below post http://stackoverflow.com/questions/9703071/how-to-get-the-image-from-uiwebview-in-ios – Balamurugan Apr 11 '13 at 09:35

1 Answers1

0

When you load the html files in your web view make sure that you set the base URL correctly using either loadHTMLString:baseURL: or loadData:MIMEType:textEncodingName:baseURL:. Then webview should load the images normally.

If you want to maximize them when the user taps, the easiest way would be something like this:

  • inject jQuery into your EPUB html in webViewDidFinishLoad:
  • add an action to all <img> tags using jQuery which calls a cocoa method using a custom url protocol like my-epub-app://maximize-img/cool-photo.jpg
  • catch and handle this custom protocol in your webView:shouldStartLoadWithRequest:navigationType: and return NO to prevent webview from trying to load your invalid URL.

Hope this helps…

Engin Kurutepe
  • 6,719
  • 3
  • 34
  • 64