Showing posts with label watch-os-2. Show all posts
Showing posts with label watch-os-2. Show all posts

Wednesday, April 13, 2016

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

Leave a Comment

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.

1 Answers

Answers 1

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.

Read More

Wednesday, March 9, 2016

WatchOS snap to next row on scroll in WKInterfaceTable

Leave a Comment

Apple's own Activity app has an interesting feature that I try to re-implement in my own watch app: Each page in the activity app is scrollable and basically has 2 vertical pages. The first page is the circle and the second page shows more information.

But these pages don't normally scroll up and down when using the digital crown - they snap. So you can't scroll in between pages. Apple seems to be using a WKInterfaceTable with two rows but I don't find any documentation how you can implement the snapping behavior.

How did they do it?

1 Answers

Answers 1

You can use WKInterfaceTable's - (void)scrollToRowAtIndex:(NSInteger)index to scroll to a specific row. To get feedback from the digital crown directly you'd have to use WKInterfacePicker, but that may or may not work in your case.

Read More