I’m using html/javascript with iOS and UIWebView.
I want to invoke an objective-c method when the user touch anywhere on the page that isn’t a link.
At the moment I have
...
<BODY ontouchend="bodyTouch();">
<HEAD>
<script language="javascript" type="text/javascript">
function bodyTouch() {
invokeObjectiveC();
}
}
</script>
...
<DIV id=buttons>
<A id=navigator href="CustomScheme:SomeAction"></A>
....
How can I set things up so that bodyTouch() only gets invoked if the user touches anywhere on the screen that isn’t a link/button/anchor etc.
==== Update ===
Thanks for lots of answers folks.
Unfortunatly I couldn’t get any of them to work (now my InvokeObjectiveC() doesn’t get called at all when I try any of them).
I’m an iOS developer and don’t know html/javascript. I’ll do a bit of studying as I don’t understand any of the answers at the moment with my limited knowledge, then try them once I understand what they are doing and try to figure out why its not working.
I’ll mark one of the answers as accepted in due course.
Cheers
give this one a shot, you should be able to place this anywhere in the document
this does not work on the input[type=button] looking buttons, if you need that as well let me know