I have UIScrollView in my app with vertical bounce enabled. I need the bounce at the bottom of the screen but not enabled at the top of the screen.
I no how to detect scrollview with the following:
(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
// no bounce if scrollView has reached the top of the screen ??
}
Try setting the bounces
property as the scroll view scrolls, based on the content offset:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
scrollView.bounces = (scrollView.contentOffset.y > 100);
}
SWIFT
func scrollViewDidScroll(_ scrollView: UIScrollView) {
//disable bounce only at the top of the screen
scrollView.bounces = scrollView.contentOffset.y > 100
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With