iOS scroll to a section in a UITable View

心不动则不痛 提交于 2020-02-07 19:41:04

问题


does anyone know how to programatically scroll a table view to a section at index path. what i'm trying to do is have tableview with 2 sections and an if statement for example

if loading = true scroll the table view up to hide the first section
when finished loading scroll table view back down to show first section

回答1:


Here is the snippet:

NSIndexPath * indexPath = [NSIndexPath indexPathForRow:row inSection:section];
[_tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];


来源:https://stackoverflow.com/questions/13069080/ios-scroll-to-a-section-in-a-uitable-view

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!