AYMADA
AYMADA

Reputation: 899

iOS UITableView how to disable scroll to bottom bouncing

I want to disable any scroll bouncing on my UITableView. For now I do it like that:

myTableView.bounces = NO;

But when I scroll to bottom of my list my content dont stop but back a little bit. How to disable this?

Upvotes: 4

Views: 6937

Answers (4)

jishnu bala
jishnu bala

Reputation: 665

UITableview is inherited form UIScrollview.So simply use the scroll view delegates.We can do the same things which we are doing for a scrollview.Please correct me if am wrong.

Upvotes: 3

ArNo
ArNo

Reputation: 2648

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.y<=0) {
        scrollView.contentOffset = CGPointZero;
    }
}

Upvotes: 5

Cocoadelica
Cocoadelica

Reputation: 3026

UITableView is a subclass of UIScrollView. UIScrollView has a property you can set to stop the bouncing.

In fact there are two you could use:

set the BOOL value of bounces to NO.

set the BOOL value of alwaysBounceVertical to NO.

Here's the link to the docs.

Upvotes: 2

PunjabiCoder
PunjabiCoder

Reputation: 525

Just uncheck the Bounce Vertically property of UITableView

enter image description here

This can also be done programmatically by setting the alwaysBounceVertical property to NO

Upvotes: 9

Related Questions