Newbie Question.
I have a UIWebView that I push HTML code into. In the HTML 开发者_JAVA百科code is an image. Is there a way to get informed that image #3 or image with name 'bob' was touched ? Some event like 'didImageWasClickedAndHereIsTheIDOfTheClickedThingy' perhaps?
I don't think there is a good way to do this that is directly supported by UIWebView, but there is a slightly hacky way.
Add JavaScript onclick handlers to your images that do something like this:
function (imgElement) {
document.location = "http://myapp/didClick/" + imgElement.id;
}
When the user taps the image, a request will me made, which can be intercepted by your app by implementing webView:shouldStartLoadWithRequest:navigationType: on the UIWebView's delegate.
加载中,请稍侯......
精彩评论