关于UITableView如何跳转到最后一行或者任意指定行

来源:互联网 发布:杰尼斯知乎 编辑:程序博客网 时间:2024/05/23 15:37

  1. 关于UITableView如何跳转到最后一行或者任意指定行。  
  2. 其实现如下:  
  3.     NSUInteger sectionCount = [self.tableView numberOfSections];  
  4.     if (sectionCount) {  
  5.    
  6.         NSUInteger rowCount = [self.tableView numberOfRowsInSection:0];  
  7.         if (rowCount) {  
  8.    
  9.             NSUInteger ii[2] = {0, rowCount - 1};  
  10.             NSIndexPath* indexPath = [NSIndexPath indexPathWithIndexes:ii length:2];  
  11.             [self.tableView scrollToRowAtIndexPath:indexPath   
  12.              atScrollPosition:UITableViewScrollPositionBottom animated:YES];  
  13.         }  
  14.     }   
0 0
原创粉丝点击