[英]Scroll to top of WKInterfaceTable in WatchKit?
我的情节WKInterfaceTable
中有一个WKInterfaceTable
。 点击一行后,我对记录显示进行了更改,但想滚动到顶部。 我该怎么做呢?
到目前为止,这是我的代码:
@IBOutlet var currentTable: WKInterfaceTable!
override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) {
// Make changes to records...
// TODO: Scroll to the top???
}
除非缺少某些内容,否则在表currentTable
的API中找不到任何内容?
我想知道您如何监督文档中的这个简单解决方案?
这应该可以解决问题:
override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int)
{
// Make changes to records...
table.scrollToRowAtIndex(0)
}
另外,您的插座似乎有问题。 如果使用IB创建它们,它将自动将它们标记为“弱”。
希望这个能对您有所帮助 :)
在WKInterfaceTable
的文档中,您将找到一个有用的方法,称为scrollToRowAtIndex
。 只需提供第一行的索引。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.