关于UITableView如何跳转到最后一行或者任意指定行。
其实现如下:
NSUInteger sectionCount = [self.tableView numberOfSections];
if (sectionCount) {
NSUInteger rowCount = [self.tableView numberOfRowsInSection:0];
if (rowCount) {
NSUInteger ii[2] = {0, rowCount - 1};
NSIndexPath* indexPath = [NSIndexPath indexPathWithIndexes:ii length:2];
[self.tableView scrollToRowAtIndexPath:indexPath
atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}
}
转载于:https://www.cnblogs.com/skyry/archive/2012/11/08/5114645.html
本文介绍了一种在UITableView中快速滚动至最后一行或任意指定行的方法。通过获取tableView的section和row数量,创建NSIndexPath,并使用scrollToRowAtIndexPath方法实现平滑滚动。此技巧适用于iOS应用开发,特别对于长列表视图的优化有显著效果。
1921

被折叠的 条评论
为什么被折叠?



