以编程方式选择下一行

时间:2015-06-15 09:05:19

标签: ios tableview

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

我的视图中有一个nextButton,我希望myTable在点击nextButton后选择下一行。

@echo off
activator clean stage
copy custom.bat c:\target\universal\stage\bin\myproject.bat

我的代码是否正确?

1 个答案:

答案 0 :(得分:1)

使用表格的当前索引创建变量

long currentindex;

创建索引路径并选择行作为代码:

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