Stop Uiwebview from "Bouncing" Vertically

Stop UIWebView from bouncing vertically?

for (id subview in webView.subviews)
if ([[subview class] isSubclassOfClass: [UIScrollView class]])
((UIScrollView *)subview).bounces = NO;

...seems to work fine.

It'll be accepted to App Store as well.

Update: in iOS 5.x+ there's an easier way - UIWebView has scrollView property, so your code can look like this:

webView.scrollView.bounces = NO;

Same goes for WKWebView.

How to Stop UIWebView from “bouncing” vertically scrolling bottom?

You can try like this :

override func viewDidLoad() {
super.viewDidLoad()

webview.scrollView.delegate = self

}

func scrollViewDidScroll(scrollView: UIScrollView) {

if (scrollView.contentOffset.y >= scrollView.contentSize.height - scrollView.frame.size.height) {
scrollView.setContentOffset(CGPointMake(scrollView.contentOffset.x, scrollView.contentSize.height - scrollView.frame.size.height), animated: false)
}
}

Set the delegate of your webview and set the content offset of the webview's scrollview

Ref taken from: https://stackoverflow.com/a/14084747/4557505

How to stop UIWebView bouncing vertically in phonegap 3.0

Make certain changes in config.xml,

If you are using it for Android, then use




And for IOS, use like




Hope this helps you.

EDIT

Do a cordova build after you have made changes in the config.xml file so that the changes affect to your project. The above steps would solve your problem only after you do a cordova build

Avoid uiwebview so much vertical scrolling

Are you using iOS5? If so then:

webView.scrollview.bounces = NO;

If you're not using iOS5, then you can search through the webView's subviews for the UIScrollView (isKindOfClass) and then set the bounces property.

In iOS in UIWeb view disable vertical scroll bounce?

alwaysBounceVertical and alwaysBounceHorizonal is set to NO by default, so your code have no effect.

Instead, you need to set bounces to NO, to disable bouncing, i.e.

self.wwTicket.scrollView.bounces = NO;

You can optionally also disable scrolling entirely, if your WebView frame and content are of the same size, i.e.

self.wwTicket.scrollView.scrollEnabled = NO;


Related Topics



Leave a reply



Submit