Home > Blockchain >  How to stop iOS app content from dragging out of bounds? Xcode Swift
How to stop iOS app content from dragging out of bounds? Xcode Swift

Time:09-16

I am pretty new to Swift and I am coding a web-app wrapper for iPhones. I have to prevent the user from scrolling up or down too far, as the app contains activities that require dragging and the "dragging" of the content really gets in the way. Now the entire content goes up when the user tries to swipe down from the top, same from the bottom - common in iOS apps. What property do I need to use to prevent that from happening?

Attaching example video of what I want to get rid of (Ebay app)

https://www.youtube.com/watch?v=777hu65V_Jg

CodePudding user response:

In the video you've shared, the page content is presumably nested inside some sort of scrollView, so you should be able to set scrollView.isScrollEnabled = false where scrollView is the name of the view that holds your content.

https://developer.apple.com/documentation/uikit/uiscrollview/1619395-isscrollenabled

CodePudding user response:

Found it. The line that solved the issue is.

    webView.scrollView.bounces = false

This prevents the bounciness of the content.

Thanks mintymuz for the clue

  • Related