UIWebView eBook Cover image not changed?

35 views Asked by At

I'm working on ePup reader project and in that there are list of ePub file that coming from server and I listed on the tableView. And there is functionality to download ePub and store in document directory. It's working good but issue is that cover image of ePub is not change as per selected ePub means When I click on first ePub. First page is cover image and display good but when I click on second ePub then display with old cover (first ePub's) image.

Here cover image name is same for both ePub "cover.jpg"

Below is code for load image on UIWebView.

NSString *imageHTML = [[NSString alloc] initWithFormat:@"%@%@%@", @"<!DOCTYPE html>"
                               "<html lang=\"ja\">"
                               "<head>"
                               "<meta charset=\"UTF-8\">"
                               "<style type=\"text/css\">"
                               "html{margin:0;padding:0;}"
                               "body {"
                               "margin: 0;"
                               "padding: 0;"
                               "color: #363636;"
                               "font-size: 90%;"
                               "line-height: 1.6;"
                               "background: transparent;"
                               "}"
                               "img{"
                               "position: absolute;"
                               "top: 0;"
                               "bottom: 0;"
                               "left: 0;"
                               "right: 0;"
                               "margin: auto;"
                               "max-width: 100%;"
                               "max-height: 100%;"
                               "}"
                               "</style>"
                               "</head>"
                               "<body id=\"page\">"
                               "<img src='",coverImgURL,@"'/> </body></html>"];

        [webView loadHTMLString:imageHTML baseURL:nil];

Where "coverImgURL" is URL of cover image from document directory.

I tried to

- [webView reload]; 
- [webView loadHTMLString:@"" baseURL:nil]; // Before load second image

But not get success can you guys suggest me where I'm going wrong?

0

There are 0 answers