iphone - prevent uiscrollview from scrolling by touch

Satyam picture Satyam · Feb 7, 2011 · Viewed 31.2k times · Source

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 ?

Answer

mrueg picture mrueg · Feb 7, 2011

Try setting yourScrollView.scrollEnabled = NO;. That should do exactly what you want.