russell russell - 1 year ago 169
Swift Question

Swift - UITableView scroll deceleration not working unless bouncing enabled for horizontal and vertical

I have a UITableView with the same settings as a tableview on another view which decelerates correctly however this view is not.

It does work if I add :

self.tableView.bounces = true
self.tableView.alwaysBounceHorizontal = true
self.tableView.alwaysBounceVertical = true

But then the table will go off horizontally removing the alwaysBounceHorizontal will then stop the table from decelerating again and stop one the user stops touching.

Has anyone come across anything like this before, as I have the same content thats being displayed on a tableview on another view working normally.

Answer Source

Managed to just about fix this, it turned out it was caused by the UIRefreshControl

It feels like a bit of a hack but I have the table scroll deceleration working normally now by adding:

func scrollViewWillBeginDecelerating(scrollView: UIScrollView) {
func scrollViewDidScroll(scrollView: UIScrollView) {
    if scrollView.contentOffset.y < 10{
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download