我有一个带有一些自定义单元格的表格 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/