Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scroll UITableView only when content doesn't fit

How can I tell a UITableView to scroll ONLY when its content doesn't fit?

I want to avoid the bouncing scroll when all rows fit into the table view.

like image 643
Enrico Detoma Avatar asked Mar 30 '11 17:03

Enrico Detoma


2 Answers

UITableView is a subclass of UIScrollView. UIScrollView has a property alwaysBounceVertical So try this:

    MyTableView.scrollEnabled =  Table_rowcount * rowheight > tableview.frame.size.height;

Also look at the alwaysBounceVertical property of UIScrollView.

like image 59
Rayfleck Avatar answered Sep 28 '22 06:09

Rayfleck


UITableView sets its alwaysBounceVertical property (which defaults to NO on UIScrollView) to YES by default. You can change this behavior by setting this property to NO.

like image 29
titaniumdecoy Avatar answered Sep 28 '22 08:09

titaniumdecoy