Reputation: 125
I was making a simple app with a slider and then I thought how can I change the background colour of the Apple Watch programatically. I know how you would normally do it for the iPhone but don't have a clue of what this one could be!
Upvotes: 2
Views: 4452
Reputation: 2381
This question covers a lot of details that this question is asking (I've summarized below). How can I set the backgroundColor of a WKInterfaceController programatically?
Create a corresponding outlet for your group and set the background color programatically like this ('self' may not be required in your context).
Set the group's radius to '0' to removed the rounded corners that reveal the background color of the watch face
Upvotes: 1
Reputation: 23078
There is no API to change the color of a WKInterfaceController
, you can set the color in InterfaceBuilder, but not in code.
Apple highly recommends to use the black color in Apple Watch Human Interface Guidelines:
Use black for your app’s background color. A black background blends seamlessly with the device bezel and maintains the illusion of no screen edges. Avoid bright background colors in your interface.
Upvotes: 4
Reputation: 1133
According to the apple developer documentation,you can follow the following syntax
func setBackgroundColor(_ color: UIColor?)
if you do not specify a custom background color or if you set the custom color to nil, the group uses the color assigned to the group object in your storyboard file. The default background color is clear.
Further,The solid background color to be displayed behind all items in the group. Specify nil to remove the custom color you previously set using this method.
Upvotes: 0