6

我需要手动以编程方式触发我的 tableView 上的单元格选择。本质上运行预制功能

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

我这样做是为了当从 tableView 中删除一个项目时,它会自动加载下一个项目。但是,当我尝试手动调用此函数时,似乎找不到它。我试过了

self.tableView: didSelectRowAtIndexPath

[tableView didSelectRowAtIndexPath]

但两者都不被认可。

4

2 回答 2

5
[self tableView:self.tableView didSelectRowAtIndexPath:selectedIndexPath];

将 selectedIndexPath 替换为下一行

确保 self 是您的表视图委托

编辑:我知道这是一个老问题,但实际上应该这样做 [tableView selectRowAtIndexPath:path animated:YES scrollPosition:UITableViewScrollPositionMiddle];

于 2012-07-27T13:25:11.010 回答
1

你应该试试:

[self tableView:self.tableView didSelectRowAtIndexPath:YourIndexPath]
于 2012-07-27T13:25:31.173 回答