Tropical Software Observations

09 October 2009

Posted by Unknown

at 9:13 AM

1 comments

Labels:

iPhone-sdk Tips: Prevent scrolling and bouncing of UIWebView

You may have a situation where you do not want the UIWebView to bounce or scroll when a user touches the view. There are 2 ways to do just that.

1. Embed Javascript function in the page itself

document.onload = function(){ document.ontouchmove = function(e){ e.preventDefault(); } };

2. Set AllowsRubberBanding to NO


[(UIScrollView*)[webview.subviews objectAtIndex:0] setAllowsRubberBanding:NO];

(Discussion here)