Search code examples
swiftwatchkit

WatchKit app change entire screen background color


I'm trying to change the entire background color of a WatchKit app using this:

self.group.setBackgroundColor(UIColor(red: 15/250, green: 121/250, blue: 205/250, alpha: 1.0))

The bottom and the top color, however, remain the default black. I set the interface controller insets left, right, top, and bottom to 0, and I also set the WKInterfaceGroup radius to zero. What am I missing?

Screenshot


Solution

  • There are a few possible problems you could be running into here.

    Glance Interface

    First off, if you are using a Glance Interface Controller, there will always be a black overlay at the bottom to account for the paging indicators. You cannot get rid of this.

    Groups

    If you are using a regular interface controller, then your group is not set up quite right. It should be "Relative to Container" for both width and height with no other sibling groups.

    Interface Controllers

    The easiest way though to set the entire background color (minus the status bar of course) is to set the background color directly on the interface controller. That will result in an image that looks like the following.

    Interface Background Color

    Somewhere in those answers should be the solution to your issue.