Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Cancel Scrolling in UIScrollView

I use UIScrollView to make large-sized (larger than 320px) UI on iPhone.

I made an instance of UIScrollView and added some subviews on it. The problem is that I want to enable scrolling only when user touches outside of subviews, stop scrolling when user touches one of subviews.

I read documents and tried to find samples but I can't find good hint. If you have any idea, please help me.

like image 785
fish potato Avatar asked Dec 20 '08 13:12

fish potato


People also ask

How do I turn off scroll view?

You can disable the scrollview's scrolling in custom renderer on each platform . Android : use RequestDisallowInterceptTouchEvent method . iOS : disable scrolling(ScrollView) when touching begin and re-enable when touching has stopped.

How do I stop ScrollView scrolling in Swift?

Basic Swift Code for iOS Apps For disabling the same we need to make the “isScrollEnabled” property of our scroll view to false. Copy the below code in your file. import UIKit class ViewController: UIViewController { @IBOutlet var scrollView: UIScrollView! override func viewDidLoad() { super.

How do I turn off scroll in singleChildScrollView flutter?

You can use the following code in your singleChildScrollView. physics: NeverScrollableScrollPhysics(), It stops it from being able to scroll.

What is scroll view in Swift?

The scroll view displays its content within the scrollable content region. As the user performs platform-appropriate scroll gestures, the scroll view adjusts what portion of the underlying content is visible. ScrollView can scroll horizontally, vertically, or both, but does not provide zooming functionality.


1 Answers

UIScrollView has a scrollEnabled property that allows you to disable scrolling programatically. It also has a delegate (UIScrollViewDelegate) that allows you to see events such as scrolling starting/ending. Seems that you should be able to cook something up with those options combined in some way.

like image 183
Stephen Darlington Avatar answered Oct 11 '22 10:10

Stephen Darlington