我目前正在尝试让uitableview自动滚动到选定的单元格。但是大约在一半时,当我现在在tableView:cellForRowAtIndexPath:内部使用此方法(如下)时,它将uitableview最终居中放置在先前选择的索引路径中,但是它然后dosnt允许用户滚动表的其余部分。它保持固定在该位置。

//Center previously ticked cell to center of the screen
[self.tableView scrollToRowAtIndexPath:oldCheckedData  atScrollPosition:UITableViewScrollPositionMiddle animated:YES];


这是我尝试实现的示例。

最佳答案

好的,我想念的一种方法就是解决问题的方法...这就是答案。

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    //Center previously ticked cell to center of the screen
    [self.tableView scrollToRowAtIndexPath:yourSelectedIndexMethod  atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
}

09-10 02:41
查看更多