我在 WKInterfaceGroup 中有一个带有长文本的标签和一个按钮。我可以将组滚动到按钮的触摸处理程序的顶部吗?
问问题
1109 次
2 回答
5
您可以从 WatchOS 4 开始执行此操作。 WKInterfaceController 具有此功能。
func scroll(to object: WKInterfaceObject, at scrollPosition: WKInterfaceScrollPosition, animated: Bool)
只需指定要滚动到的object
(例如,这可能是 a ),并在屏幕上指定它应该滚动到的(在您的情况下),就可以了。所以在你的 WKInterfaceController 类中:WKInterfaceGroup
scrollPosition
.top
scroll(to: objectToShowAtTheTopOfTheScreen, at: .top, animated: true)
于 2017-11-25T11:53:30.263 回答
1
不可以。使用 WatchKit 以编程方式滚动界面的唯一方法是滚动到WKInterfaceTable
.
于 2015-05-29T19:24:18.077 回答