简体   繁体   中英

WKInterfaceTable add scroll bar "flash' and remove scroll bar from non-scrolling view

I have two questions regarding WatchKit:

1) I have an app that uses [WKInterfaceTable]. One of the interfaces is scrollable.As such, when the user scrolls, the scroll bar appears in the top right corner of the watch interface.

How do I get the scroll bar to temporary flash the scroll bar when the user opens the app. A good example of this functionality is the Calendar app in Apple watch. I've combed the net and WatchKit catalog ( https://developer.apple.com/library/ios/samplecode/WKInterfaceCatalog/Introduction/Intro.html ) but was not able to find a solution.

2) I have another interface that only shows one row on the watch and therefore does not need to scroll. How do I remove the scroll view in this case?

I am using WatchKit 2.0 and writing the app in Objective-C.

I wonder if you could get the desired effect by scrolling to the top programmatically after the view has loaded?

table.scrollToRowAtIndex(0)

If that didn't work, then perhaps (again after load) scroll to the second row and then back to the first to cause the bar to display?

table.scrollToRowAtIndex(1) table.scrollToRowAtIndex(0)

I haven't tried this, but I have programmatically traveled to rows in a WKInterface table and I believe you do get the scroll bar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM