iOS TableView滚动到最底部(带滚动效果)
作者:
锅锅中的鱼 | 来源:发表于
2016-03-06 00:18 被阅读6425次#pragma mark - 滑到最底部
- (void)scrollTableToFoot:(BOOL)animated
{
NSInteger s = [self.tableView numberOfSections]; //有多少组
if (s<1) return; //无数据时不执行 要不会crash
NSInteger r = [self.tableView numberOfRowsInSection:s-1]; //最后一组有多少行
if (r<1) return;
NSIndexPath *ip = [NSIndexPath indexPathForRow:r-1 inSection:s-1]; //取最后一行数据
[self.tableView scrollToRowAtIndexPath:ip atScrollPosition:UITableViewScrollPositionBottom animated:animated]; //滚动到最后一行
}
本文标题:iOS TableView滚动到最底部(带滚动效果)
本文链接:https://www.haomeiwen.com/subject/ufkakttx.html
网友评论