开发者

Scroll UITableView only when content doesn't fit

开发者 https://www.devze.com 2023-02-20 16:04 出处:网络
How can I tell a UITableView to scroll ONLY when its content doesn\'t fit? I want to avoid the bouncing scroll when all rows fit int开发者_高级运维o the table view.UITableView is a subclass of UIScro

How can I tell a UITableView to scroll ONLY when its content doesn't fit?

I want to avoid the bouncing scroll when all rows fit int开发者_高级运维o the table view.


UITableView is a subclass of UIScrollView. UIScrollView has a property alwaysBounceVertical So try this:

    MyTableView.scrollEnabled =  Table_rowcount * rowheight > tableview.frame.size.height;

Also look at the alwaysBounceVertical property of UIScrollView.


UITableView sets its alwaysBounceVertical property (which defaults to NO on UIScrollView) to YES by default. You can change this behavior by setting this property to NO.

0

精彩评论

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

关注公众号