storyboardwatchkitapple-watchwatchoswkinterfacetable

Apple watch: How to scroll only table contents, and not the whole watch user interface?


To learn watch programming, I have set up a little test app that consists only of an image and a table:

enter image description here

The app is executed by the iOS and watch simulators. Image and table contents are correctly set by the app.

When the table is too long to fit completely on the watch screen, I expected that tapping on the table would allow it to scroll the table contents. However, the complete watch content is scrolled, including the image (please note that the green disk has been scrolled half out of sight):
enter image description here

What do I have to do to keep the image fixed on the screen, yet allow the table contents to vertically scroll?


Solution

  • While the private API supports what you want to do, that feature isn't publicly available to us either in watchOS 2 or watchOS 3.

    We're limited to either the entire interface scrolling (when its content is larger than the screen size), or the entire interface not scrolling at all (when its content fits within the screen size).

    You may want to submit a feature request asking for a static group, sticky table row header, or scrolling region.

    What comes close...

    The new WKCrownSequencer and WKCrownDelegate would let you interact with a scene or specific interface object, but there's no way to override the system's gesture recognition and scroll support on behalf of the entire scrolling interface controller.

    I don't think there's an elegant way to implement what you want now, that would work perfectly.

    If you're determined to hack or rethink this...

    If you don't want to wait for Apple to eventually offer proper support for what you want, here are a few options which might help you approach this from a different direction.