[英]How can I stop the UITableView over scroll at the top and bottom?
I am using a UITableView
with UITableViewCells
and I want to stop the "over" scroll that you get at the top and bottom of the list, The bit where you can pull down on the very top cell to show the background (sometimes used to refresh) Is there anyway to just make the top edge of the cell the "absolute top"?我正在使用带有
UITableView
的UITableViewCells
,我想停止在列表顶部和底部获得的“over”滚动,您可以在最顶部的单元格上下拉以显示背景(有时用于刷新) 有没有办法让单元格的顶部边缘成为“绝对顶部”? so the view only ever shows just the cells?所以视图只显示单元格?
Since UITableView is a subclass of UIScrollview, it should suffice to just set the 'bounces' property to NO.由于 UITableView 是 UIScrollview 的子类,因此只需将 'bounces' 属性设置为 NO。
Edit: you probably need to set'alwaysBounceVertical' to NO, too...编辑:您可能也需要将“alwaysBounceVertical”设置为 NO...
您可以将 tableview 反弹属性设置为 NO。
You can use this code to solve your Problem您可以使用此代码来解决您的问题
self.objBackTableView.bounces = NO;
And used Below code to if data is fit on screen than its not scroll并使用下面的代码来判断数据是否适合屏幕而不是不滚动
self.objBackTableView.alwaysBounceVertical = NO;
Swift 4.2:斯威夫特 4.2:
It's not scroll at all:它根本不是滚动:
tableView.bounces = false
It's not scroll if there is enough space for cells:如果单元格有足够的空间,则不会滚动:
tableView.alwaysBounceVertical = false
Hope to be useful.希望有用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.