如何设置ios tableView的section跟着tableView一起滚动

2025-05-16 22:05:30
推荐回答(1个)
回答(1):

[self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:_currentRow inSection:0] animated:YES scrollPosition:UITableViewScrollPositionMiddle]; 首先使用selectRowAtIndexes: 选择行数,滚动的话tableview的superview时scrollview,scrollview可以滚动到某个position 那么就要计算这个position position = table row height * index,就得到滚动的位置了。