Reputation: 15904
I've a scrollview and on both sides, I've two buttons left and right.
when i click the scroll view will move left and when right button is clicked it will move right side. My scrollview has 20 buttons (approx) & on click of each button some action is performed.
Everything is perfectly implemented and working fine.
Only thing i couldn't implement is to prevent scrolling by touch. I don't want user to scroll the scrollview manually. How can i prevent it from scrolling by touch and still able to click the buttons inside the scrollview ?
Upvotes: 40
Views: 36690
Reputation: 483
Maybe your issue is that when using UIView.animate and the options:
[.allowUserInteraction], is not set.
After this option set, the scrollview should stop on tap.
Upvotes: 0
Reputation: 6405
If those buttons are the only interface for users, disable 'User Interaction Enabled' option of the scroll view in the Interface Builder. Or, programmatically, set userInteractionEnabled
property to NO.
Upvotes: 0
Reputation: 8225
Try setting yourScrollView.scrollEnabled = NO;
. That should do exactly what you want.
Upvotes: 110