NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:2];
CGRect frame = [tableview rectForSection:indexPath.section];
[tableview setContentOffset:CGPointMake(0, frame.origin.y) animated:YES];
本文介绍了一种在iOS应用中使用Objective-C实现TableView自动滚动到指定section的方法。具体步骤包括创建NSIndexPath实例,获取目标section的CGRect,然后设置TableView的内容偏移量以实现平滑滚动。
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:2];
CGRect frame = [tableview rectForSection:indexPath.section];
[tableview setContentOffset:CGPointMake(0, frame.origin.y) animated:YES];

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