【问题标题】:Scrolling UITableview bottom row to top position将 UITableview 底行滚动到顶部位置
【发布时间】:2014-04-04 18:15:48
【问题描述】:

在一个 tableView 中,section0 上有 4 行,section1 上有 3 行。如果我点击 indexPath (1,2) 处的行,则会出现另一行,其中包含 UIPickerView。我希望 tableView 滚动,以便 pickerView 在屏幕顶部移动。为此,我实施了

[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];

但这只会向上滚动一点,不多。

这里有什么我遗漏的吗?任何帮助将非常感激。提前致谢。

【问题讨论】:

    标签: ios uitableview uiscrollview xcode5


    【解决方案1】:

    嗯,这很尴尬。碰巧你不需要上面的代码介于

    [self.tableView beginUpdates];
    
    ...
    
    [self.tableView endUpdates];
    

    如果有人遇到同样的问题,我会在这里留下答案。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-18
      • 1970-01-01
      • 1970-01-01
      • 2018-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-17
      相关资源
      最近更新 更多