Select 以编程方式下一行

Select next row programmatically

如何在 iOS 中以编程方式 select 下一行?

我的视图中有一个 nextButton,我希望 myTable 在单击 nextButton 后 select 到下一行。

[myTable selectRowAtIndexPath: ??????
                 animated:YES 
           scrollPosition:UITableViewScrollPositionMiddle];

我的代码正确吗?

使用您当前的 table

索引创建一个变量
long currentindex;

创建索引路径和 select 行作为您的代码:

currentindex = currentindex +1;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:currentindex inSection:0];
[myTable selectRowAtIndexPath: indexPath
                 animated:YES 
           scrollPosition:UITableViewScrollPositionMiddle];