gpt4 book ai didi

ios - 检测 UITableView 中当前可见的最后一个 UITableViewCell

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:28:49 24 4
gpt4 key购买 nike

我想知道是否有一种方法可以检测当前的 UITableViewCell 是否是 View 中的最后一个,然后当用户按下回车键时,您将使用此代码滚动 UITableView

int cellHeight = 44;
[finishingTableView setContentOffset:CGPointMake(finishingTableView.contentOffset.x,finishingTableView.contentOffset.y + cellHeight) animated:YES];

我有一个带有自定义 UITableViewCells 的 UITableView,每个 UItableViewCell 都有一个 UITextfield,我以编程方式选择 UITableViewCell,然后使单元格文本字段成为第一响应者。我想让用户一直按回车键到 UITableView 的底部,但只有在下一个要选择的 UITableViewCell 不在 View 中时才开始滚动。

最佳答案

使用 UITableViewindexPathsForVisibleRows 方法。

NSArray *visibleRows = [self.tableView indexPathsForVisibleRows];
NSIndexPath *lastRow = [visibleRows lastObject];

然后将其与您正在处理的单元格的 indexPath 进行比较。

关于ios - 检测 UITableView 中当前可见的最后一个 UITableViewCell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21494377/

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