滚动条没有到达tableview的末尾。

时间:2021-06-07 21:00:59

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

我不知道确切的原因,但是我的tableview的滚动条永远不会结束。

This is the middle of the tableview, everything looks fine

这是tableview的中间,一切看起来都很好

滚动条没有到达tableview的末尾。

But when I reach the end

但当我到达终点的时候

滚动条没有到达tableview的末尾。

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.

我想我的约束是可以的(我在使用autolayout),因为除了滚动条,tableview显示得很好。

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

我的视图控制器是一个UIViewController,只包含一个UITableView。下面是一个总结:

滚动条没有到达tableview的末尾。

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.

编辑:我尝试删除和重新创建视图控制器(通过复制和粘贴UITableView),问题仍然存在。

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

Edit2:如果我把底部的限制改为“视图底部”而不是“底部布局指南”,那么这就很好了。

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

问题是我的视图没有一个正确的高度,因为它应该在tabbar下面。

Any ideas ?

什么好主意吗?

4 个解决方案

#1


2  

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

通过将属性automaticallycontrollsscrollviewinsets设置为NO,我解决了这个问题。

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

更多细节可以在这里找到:https://*.com/a/2130225/1295537

#2


1  

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

可能会发生的情况是,您已经禁用了剪切功能,而tableView的框架并不是视图的整个高度。

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

或者,您可以设置contentInsets,它也会更改滚动指示器的大小。

#3


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)

对于那些上面的解决方案不起作用的人,试试这个。它没有意义,但是它可以工作(在我的例子中,我需要UITableView来支持其他视图,所以我添加了一个虚拟视图)

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

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

#4


-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.

没有使用常规视图控制器并在故事板中拖动tableview(我假设您正在这样做),您是否考虑过使用一个表视图控制器?在那种情况下你不应该有这个问题(我从来没有)。可以很容易地将表视图控制器嵌入到选项卡栏控制器中。

Hope this helps!

希望这可以帮助!

#1


2  

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

通过将属性automaticallycontrollsscrollviewinsets设置为NO,我解决了这个问题。

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

更多细节可以在这里找到:https://*.com/a/2130225/1295537

#2


1  

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

可能会发生的情况是,您已经禁用了剪切功能,而tableView的框架并不是视图的整个高度。

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

或者,您可以设置contentInsets,它也会更改滚动指示器的大小。

#3


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)

对于那些上面的解决方案不起作用的人,试试这个。它没有意义,但是它可以工作(在我的例子中,我需要UITableView来支持其他视图,所以我添加了一个虚拟视图)

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

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

#4


-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.

没有使用常规视图控制器并在故事板中拖动tableview(我假设您正在这样做),您是否考虑过使用一个表视图控制器?在那种情况下你不应该有这个问题(我从来没有)。可以很容易地将表视图控制器嵌入到选项卡栏控制器中。

Hope this helps!

希望这可以帮助!