开发者

Disable UITableView vertical bounces when scrolling

How do I disable the bounce effect when vertically scrolling a UITableView? Right now if I scroll anywhere near the bottom, the view scrollbar bo开发者_JAVA百科unces right up. I would like my UITableView to stay fixed at the scrolled-to position instead of bouncing back up.


Have you tried setting the bounces property to NO?


With the help of interface:

Uncheck the Bounce Vertically property of UITableView

Disable UITableView vertical bounces when scrolling


If you want to do it programmatically, you can do it like that:

self.myTableView.alwaysBounceVertical = NO;


You can use the below code with swift 4.x.x

self.myTableView.alwaysBounceVertical = false


Put this line inside viewDidLoad

tableView.bounces = false


swift 5:

self.tableView?.alwaysBounceVertical = false
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜