I have a web view displaying many images from any URL. When I click or longpress on particular image I need to download that image data .
How is it possible?
I have a web view displaying many images from any URL. When I click
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A simple solution would be to keep listening to the
UIWebviewdelegate,shouldStartLoadWithRequestand whenever the URL ends with a .jpg or .png, you could stop the redirection and download the image manually.A more complex approach would be to use javascript and detect the point(x,y) of the touch on the
UIWebviewand then find corresponding element tag. If the element is an image, you then do a image download using the above method. But this is complicated and i’m not entirely sure if this can be achieve. If the first approach doesn’t help you then this is worth a shot, if you ask me.EDIT-
You should put a gesture recogniser
UILongPressGestureRecognizerand add a listener. So you could then call your java script function from there instead of doing it from the touches delegate method.