Reputation: 61
Is there a way to prevent a UIWebView from being dragged? Also, is there a way to actually overwride the common UIWebView functions such as highlighting?
Hope someone can answer me.
Thanks
Upvotes: 0
Views: 1752
Reputation: 47241
You can look up the scrollView of the webView and disable the scrolling with this code:
UIScrollView *scrollView = nil;
for(UIView *aView in webView.subviews){
if([aView isKindOfClass:[UIScrollView class] ]){
scrollView = (UIScrollView *)aView;
scrollView.scrollEnabled = NO;
scrollView.bounces = NO;
}
}
Upvotes: 1
Reputation: 4487
To prevent the drag:
<script type="text/javascript" language="javascript">
document.ontouchmove = function(e)
{
e.preventDefault();
}
</script>
To override the highlighting:
<style type="text/css">
body
{
-webkit-user-select: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none;
}
</style>
So, on the highlighting part:
Keep the ones you need.
Hope this helps :)
Upvotes: 0