Search code examples
iosxcodeswiftwatchkit

Gradient over storyboard in Watchkit/Xcode


I have a design for an apple watch app that consists of a table with five rows. I want to have a gradient that is overlain on top of the screen so that the screen gets darker further down the screen

The rows need to be the same colour so that when you scroll up then obviously they scroll 'above' the gradient

This should hopefully explain what I mean: Image

Is there a way of doing this in xcode or using swift?

Thanks!


Solution

  • Unfortunately, as rmp mentioned in the comment, there is no way to accomplish this in the current version of WatchKit. The only "layering" that is possible is by setting the background image of a WKInterfaceGroup that contains other image elements that appear "on top." In this case, however, you'd need an image above the WKInterfaceTable, and that functionality isn't available.

    While you might think that you could alter the cell background colors as the table scrolls to achieve a similar effect, you can't determine the scroll location of a WKInterfaceTable, so there's no way to do this either.