gpt4 book ai didi

ios - UITableViewScrollPositionNone 不滚动表格 View

转载 作者:可可西里 更新时间:2023-11-01 03:30:47 25 4
gpt4 key购买 nike

当使用 selectRowAtIndexPath:animated:scrollPosition: 时,我传入了 UITableViewScrollPositionNone。尽管名称如此,但我希望 tableview 在必要时滚动,以便该行可见(如果它已经可见则不滚动)。

UITableViewScrollPositionNone - The table view scrolls the row of interest to be fully visible with a minimum of movement. If the row is already fully visible, no scrolling occurs. For example, if the row is above the visible area, the behavior is identical to that specified by UITableViewScrollPositionTop. This is the default.

但是,我发现表格 View 根本不滚动。如果我使用 UITableViewScrollPositionTopUITableViewScrollPositionBottom,表格 View 会按预期滚动。

这方面的文档有可能不正确吗?或者我错过了什么?

最佳答案

UITableView 的 selectRowAtIndexPath:animated:scrollPosition: 的文档中有一节描述了您遇到的情况。

Special Considerations Passing UITableViewScrollPositionNone will result in no scrolling, rather than the minimum scrolling described for that constant. To scroll to the newly selected row with minimum scrolling, select the row using this method with UITableViewScrollPositionNone, then call scrollToRowAtIndexPath:atScrollPosition:animated: with UITableViewScrollPositionNone.

希望对您有所帮助!

关于ios - UITableViewScrollPositionNone 不滚动表格 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14223259/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com