swift3 – Swift 3 scrollToRowAtIndexPath成为scrollToRow

我正在转换一个 Swift 2.3项目o Swift 3并挖掘数千个变化

我目前有这样的代码

outletCatalog.scrollToRowAtIndexPath(myIndex,atScrollPoisition: .top,animated: false)

但是,它显然被替换为

func scrollToRow(at: IndexPath,at: UITableViewScrollPosition,animated: Bool)

但是 – 我不明白“at”的双参数命名,我的Google搜索没有产生任何结果.代码翻译工具只是表明了它

scrollToRow(at:at:animated)
在从Swift 2.3到Swift 3.2版本的代码转换之后,您需要在GCD主调度块内调用以下代码,并将自动滚动行的新更改调用到索引.
dispatchQueue.main.async {
   let index = IndexPath(row: 10,section: 0) // use your index number or Indexpath
   self.tableCart.scrollToRow(at: index,at: .middle,animated: true) //here .middle is the scroll position can change it as per your need
}

我希望它对你有用.

SupportSwift 3.1,3.2,4.1

相关文章

软件简介:蓝湖辅助工具,减少移动端开发中控件属性的复制和粘...
现实生活中,我们听到的声音都是时间连续的,我们称为这种信...
前言最近在B站上看到一个漂亮的仙女姐姐跳舞视频,循环看了亿...
【Android App】实战项目之仿抖音的短视频分享App(附源码和...
前言这一篇博客应该是我花时间最多的一次了,从2022年1月底至...
因为我既对接过session、cookie,也对接过JWT,今年因为工作...