Reputation: 3246
I have a WKWebView
which has some images added with the <img src=...>
tag, they are locally cached and I insert them into the WKWebView
.
The images aren't being loaded from the web, with the regular <a href...>
As that , I want to present the tapped image to the user, but since the WKWebView
could have a lot of images, I'm trying to detect the tap on the specific image, without success.
I tried the decidePolicyFor
WKNavigationDelegate
method, but anytime I tap an image no navigationType
is called, and I don't know if I'm missing something here.
Thanks
Upvotes: 2
Views: 1402
Reputation: 3246
So I have managed to surpass this issue.
Somehow I didn't knew I could create a link to a locally cached image as @GIJOW said.
After reading about it here I have managed to display an image inside the WKWebView
as it was before, but the whole image is now tappable because it is embeded in a <a href>
tag as the following.
Previous
<img src=\"\(imageNameHere)\"/>
After
<a href=\"some_url_or_link_you_want\"><img src=\"\(imageNameHere)\"/></a>
Upvotes: 1