7

I don't know exactly why, but the scrollbar of my tableview never reaches the end.

This is the middle of the tableview, everything looks fine

enter image description here

But when I reach the end

enter image description here

The scrollbar doesn't reach the end...

I guess my constraints are ok (I'm using autolayout), because besides the scrollbar, the tableview is well displayed.

My view controller is a UIViewController and contains only a UITableView. Here is a screenshot that sums it up :

enter image description here

No constraint is added by code. Do you know how could I debug this?

Thanks in advance

Edit : I have tried to delete and recreate the view controller (by copy and pasting the UITableView) the problem is still here.

Edit2 : If I change the bottom constraint to "Bottom of the view" instead of "Bottom layout guide", this works well.

The problem is that my view doesn't have a correct height, because it is supposed to go under the tabbar.

Any ideas ?

Vico
  • 1,696
  • 1
  • 24
  • 57
  • Possible duplicate of [automaticallyAdjustsScrollViewInsets not working](http://stackoverflow.com/questions/21069258/automaticallyadjustsscrollviewinsets-not-working) – bummi Feb 01 '16 at 06:59

4 Answers4

2

I've fixed the problem by settings the property automaticallyAdjustsScrollViewInsets to NO.

More details could be found here: https://stackoverflow.com/a/21302259/1295537

Community
  • 1
  • 1
Vico
  • 1,696
  • 1
  • 24
  • 57
1

What could be happening is you have clipping disabled, and the frame for your tableView isn't the entire height of the view.

Or, you could have contentInsets set, which changes the size of the scroll indicator as well.

Vadoff
  • 9,219
  • 6
  • 43
  • 39
  • I have tried to disable contentInsets with : `[self.tableView setContentInset:UIEdgeInsetsMake(0, 0, 0, 0)];` But it doesn't change anything. I also have tried to enable clipping with `[self.tableView setClipsToBounds:YES]` (is it what you meant?), but still doesn't work. Thanks for your help. – Vico Jul 30 '14 at 21:29
  • 1
    Well you could try shifting the scrollIndicator via the `scrollIndicatorInsets` property, but this will only adjust the scrollIndicator position, not the actual size - so your indicator may still not span the entire height. – Vadoff Jul 30 '14 at 21:39
  • Settings Indicator insets to 0 doesn't change anything. I could maybe use negative insets, but I'm not sure this is very clean – Vico Jul 31 '14 at 08:52
  • `UIEdgeInsets insets = UIEdgeInsetsMake(0, 0, (-1)*50, 0); [self.tableView setScrollIndicatorInsets:insets];` Works well :( – Vico Jul 31 '14 at 09:03
  • I know you fixed it, but you could also try: `self.edgesForExtendedLayout = UIRectEdgeNone` OR `self.automaticallyAdjustsScrollViewInsets = NO;` – Vadoff Aug 02 '14 at 03:17
0

For those who the above solutions don't work, try this. It makes no sense tho, but it works (In my case I needed the UITableView to behind other views, so I just added a dummy view)

https://stackoverflow.com/a/23019724/1148910

Community
  • 1
  • 1
-1

Instead of using a normal View Controller and dragging in a tableview in a storyboard (which I assume you're doing), have you considered using a Table View Controller? You shouldn't have this problem in that case (I never have). You can easily embed the Table View Controller in the Tab Bar Controller.

Hope this helps!

trevorj
  • 2,029
  • 1
  • 16
  • 11
  • 1
    Thanks for your help, but for more flexibility I decided to use a `UIViewController` instead of a `UITableViewController` – Vico Jul 30 '14 at 21:07