Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/111.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 Swift:Xcode表格视图无限滚动_Ios_Xcode_Swift_Uitableview - Fatal编程技术网

Ios Swift:Xcode表格视图无限滚动

Ios Swift:Xcode表格视图无限滚动,ios,xcode,swift,uitableview,Ios,Xcode,Swift,Uitableview,我有一个swift的tableView,有大约500个单元格。我希望它能够在没有任何用户输入的情况下自己滚动。有点像股票行情显示信息。我该怎么做?此外,当它到达底部时,我希望它再次从顶部开始。有什么方法或工具可以做到这一点吗?有一种方法可以使用:ScrollToRowatineXpath:atScrollPosition:animated: 以下是文档的链接: :您可以使用一种方法:ScrollToRowatineXpath:atScrollPosition:animated: 以下是文档的链接

我有一个swift的tableView,有大约500个单元格。我希望它能够在没有任何用户输入的情况下自己滚动。有点像股票行情显示信息。我该怎么做?此外,当它到达底部时,我希望它再次从顶部开始。有什么方法或工具可以做到这一点吗?

有一种方法可以使用:ScrollToRowatineXpath:atScrollPosition:animated:

以下是文档的链接:

您可以使用一种方法:ScrollToRowatineXpath:atScrollPosition:animated:

以下是文档的链接:

您可以使用
scrollToRowAtIndexPath
并将其与
UIView的
animateWithDuration
方法结合使用

var indexPath = NSIndexPath(forRow: rowNumberHere, inSection: 0)
self.tableview.scrollToRowAtIndexPath(indexPath, 
               atScrollPosition: UITableViewScrollPosition.Bottom, animated: true)
您还可以使用计时器每次滚动到下一个单元格,当您到达最后一个单元格时,可以逐个单元格再次滚动到顶部

var timer = NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: Selector("roll"), userInfo: nil, repeats: true)


func roll() {
    // scroll to next row until we reach the last cell, in that case scroll back until reach the first cell
}

可以提供帮助,但它在Objective-C中

您可以使用
滚动箭头路径
并将其与
UIView的
animateWithDuration
方法相结合

var indexPath = NSIndexPath(forRow: rowNumberHere, inSection: 0)
self.tableview.scrollToRowAtIndexPath(indexPath, 
               atScrollPosition: UITableViewScrollPosition.Bottom, animated: true)
您还可以使用计时器每次滚动到下一个单元格,当您到达最后一个单元格时,可以逐个单元格再次滚动到顶部

var timer = NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: Selector("roll"), userInfo: nil, repeats: true)


func roll() {
    // scroll to next row until we reach the last cell, in that case scroll back until reach the first cell
}

可能会有帮助,但它在Objective-C中

听起来似乎表格视图不是一个真正合适的视图。如果它只是一个股票行情。应该可以相当容易地滚动您自己的股票与一个池的意见,得到重用和动画的方向所需的。SpriteKit将使这变得非常简单。听起来table视图并不是一个真正合适的视图。如果它只是一个股票行情。应该可以相当容易地滚动您自己的股票与一个池的意见,得到重用和动画的方向所需的。SpriteKit会让这一切变得非常简单。