Matte.Car
Matte.Car

Reputation: 2027

Customise title in the WK Status Bar

I'm trying to customise title in the WK Status Bar of my first Controller.

enter image description here

The correct way should be this:

public func setTitle(title: String?) // title of controller. displayed when controller active

so

WKInterfaceController.setTitle("my Title")

but using this code, xCode says Cannot convert value of type 'String' to expected argument type 'WKInterfaceController'. What's wrong?

Upvotes: 1

Views: 319

Answers (1)

user4151918
user4151918

Reputation:

setTitle is an instance method, not a class method.

You need to refer to a specific instance controller to change that controller's title. Since you would generally be setting your first controller's title within its own code, you can omit self, and simply call

setTitle("my Title")

Upvotes: 2

Related Questions