ios - 滚动到 WatchKit 中 WKInterfaceTable 的顶部?

标签 ios swift watchkit apple-watch wkinterfacetable

我的 Storyboard中有一个 WKInterfaceTable。当点击一行时,我对记录显示进行更改,但想滚动到顶部。我该怎么做?

这是我的代码到目前为止的样子:

@IBOutlet var currentTable: WKInterfaceTable!

override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) {
    // Make changes to records...

    // TODO: Scroll to the top???
}

我在 API 中找不到表 currentTable 的任何内容,除非我遗漏了某些内容?

最佳答案

我想知道您是如何在文档中监督这个简单的解决方案的?!

这应该可以解决问题:

override func table(table: WKInterfaceTable, didSelectRowAtIndex rowIndex: Int) 
{
    // Make changes to records...

    table.scrollToRowAtIndex(0)
}

而且你的 socket 似乎是错误的。如果您使用 IB 创建它们,它会自动将它们标记为“弱”。

希望这对你有帮助:)

关于ios - 滚动到 WatchKit 中 WKInterfaceTable 的顶部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29878330/

相关文章:

ios - 无法构建模块 'React'

ios - iPhone 已拒绝启动请求 Unspecified

ios - Xcode 项目在一台设备上运行但在另一台设备上不运行

ios - watchKit 无法在模拟器上运行

ios - 如何在watch OS 2中使用Kingfisher图像库或AlamofireImage?

ios - DNS Ubiquiti Identity DidChangeNotification 不会通过 cloudkit 触发

ios - 如何在 Swift 中将新单元格插入 UITableView

ios - 如何清除/删除iOS上的键盘缓存?

ios - UIView 滑动手势改变图像

ios - 在 iPhone 和 Watch 应用程序中共享文档目录中的数据