Is it possible to bounce a UITableView
on the bottom side, but not the top? If so, please show me code.
Instead of changing the bounces
property, I added that to the UIScrollViewDelgate
method:
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
if (scrollView.contentOffset.y<=0) {
scrollView.contentOffset = CGPointZero;
}
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
//Check to make sure this only applies to tableview
//and not other scrollviews inside your View/ViewController
if scrollView.superclass == UITableView.self {
//bounce will only be true if contentOffset.y is higher than 100
//I set 100 just to make SURE, but you can set >= 0 too
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