gpt4 book ai didi

ios - 按下 UITableViewCell 内的按钮时的 scrollToRowAtIndexPath

转载 作者:行者123 更新时间:2023-12-01 18:21:37 26 4
gpt4 key购买 nike

我有一个带有一些自定义单元格的表格 View 。第一个里面是一个按钮。当按下这个按钮时,我想滚动到我的表格 View 中的某个部分。我如何必须将按钮操作与 tableview 链接?

最佳答案

您可以使用此功能滚动到某个部分:

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated

使用示例是:
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:5 inSection:indexPath.section] 
atScrollPosition:UITableViewScrollPositionMiddle animated:NO];

并将按钮操作与 tableview 链接,您可以在自定义单元格中使用协议(protocol)

关于ios - 按下 UITableViewCell 内的按钮时的 scrollToRowAtIndexPath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16884926/

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