Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何滚动通过UIPopoverController打开的UITableview_Ios_Uitableview_Scroll_Uipopovercontroller - Fatal编程技术网

Ios 如何滚动通过UIPopoverController打开的UITableview

Ios 如何滚动通过UIPopoverController打开的UITableview,ios,uitableview,scroll,uipopovercontroller,Ios,Uitableview,Scroll,Uipopovercontroller,在iOS 4中,我有一个UIPopoverController,它打开一个UITableViewController,其中包含一长串项目(66)。 如何以编程方式滚动到tableview的特定单元格?您可以使用UITableView的此方法: - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOO

在iOS 4中,我有一个UIPopoverController,它打开一个UITableViewController,其中包含一长串项目(66)。
如何以编程方式滚动到tableview的特定单元格?

您可以使用
UITableView
的此方法:

- (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated
参数

  • 索引XPath: 一种索引路径,通过行索引和节索引标识表视图中的行

  • 滚动位置: 当滚动结束时,标识接收表视图(顶部、中部、底部)中行的相对位置的常量。请参阅“表格视图滚动位置”a有效常数的说明

  • 动画: 如果要设置位置更改的动画,则为“是”,如果应立即更改,则为“否”


  • 让我澄清一下,这不是一个复制/重复的答案。你看,所有答案之间的时间差异都很小。好吧,我不是来争论这么愚蠢的事情的。不管怎样……别管了。伊阿普,谢谢你的回答。我的实现中缺少的是“self”(在self.tableView中),您的回答帮助我澄清了这一点。感谢Nekto的回答,这对我很有帮助。
    NSIndexPath * someRowAtIndexPath = [NSIndexPath indexPathForRow:3 inSection:4];
    [tableView scrollToRowAtIndexPath:someRowAtIndexPath atScrollPosition:UITableViewScrollPositionBottom animated:YES];
    
        [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathWithIndex:1] atScrollPosition: UITableViewScrollPositionNone animated:NO];