0
votes

I can set the background image in the Interface Storyboard to a huge collection of system templates (see screenshot). Is there any access to those templates by code?

I have an outlet to the button:

@IBOutlet weak var button1: WKInterfaceButton!

Now I found three possible functions:

  1. button1.setBackgroundImage(UIImage?)
  2. button1.setBackgroundImageData(Data?)
  3. button1.setBackgroundImageNamed(String?)

I managed it to change the background image of the button to one of my own images (sample.png), but is there any way to address the system templates?

Thank you.

All the best, Stephan

screenshot templates

1

1 Answers

0
votes

sorry for placing this simple question. In the meantime I solved the task myself.

Actually it is pretty easy. But maybe someone has the similar problem.

The code is:

button1.setBackgroundImage(UIImage(systemName: "pencil.tip"))

"pencil.tip" is the name in the dropdown menu from the Interface Storyboard.

Ciao for now, Stephan