Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIScrollView disable scrolling in just one direction?

Tags:

uiscrollview

I've been unable to find an answer for this (maybe someone has hacked a solution together).

Is it possible to disable scrolling in a UIScrollView in one direction? I am not talking about disabling vertical or horizontal scrolling, but one direction only. So for example, in a UIScrollView, I want to be able to drag the scrollview in a downwards direction, but not in an upwards direction

Thanks

like image 726
runmad Avatar asked Mar 20 '11 18:03

runmad


1 Answers

Turns out a simple solution was actually possible and easy:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView {     if (scrollView.contentOffset.y > 60) {         [scrollView setContentOffset:CGPointMake(0, 60)];     } } 
like image 84
runmad Avatar answered Oct 14 '22 17:10

runmad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!