Sus*_*rma 0 objective-c uitableview ios
我有UITableView1个部分和numberOfRows:来自NSMutableArray.
我想要的是每当UITableView出现滚动视图时必须滚动到最后一行.
为此我想要indexPath最后一行.怎么弄?
我知道这个问题已被多次回答.但这些方法都不适合我.
这是我试过的代码
-(NSIndexPath*)lastIndexPath{
NSInteger sectionsAmount = [myTableView numberOfSections];
NSInteger rowsAmount = [myTableView numberOfRowsInSection:sectionsAmount-1];
NSIndexPath *lastIndexPath = [NSIndexPath indexPathForRow:(rowsAmount - 1) inSection:(sectionsAmount - 1)];
return lastIndexPath;
}
Run Code Online (Sandbox Code Playgroud)
由于你只有一个部分,你可以找到索引路径
[NSIndexPath indexPathForRow:[yourArray count]-1 inSection:0]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5382 次 |
| 最近记录: |