borisy borisy - 10 months ago 132
Swift Question

WKInterfacePicker Caption

Do you know how to add static caption to the watchOS picker? The caption looks like this and it says Item 1.

Black square with Apple Watch picker deploying colours: Red, Green, highlighted in green with bright green caption on top which says item 1

I already selected appropriate style in the Interface Builder:

Displays macOS drop down menu with 3 options. Outline with caption is selected.

My code:

override func awakeWithContext(context: AnyObject?) {

let item1 = WKPickerItem()
item1.title = "10"
let item2 = WKPickerItem()
item2.title = "20"
let item3 = WKPickerItem()
item3.title = "30"
picker.setItems([item1, item2, item3])


Result I got in the Simulator:

Apple Watch screenshot with the picker and 2 buttons. Picker also outlined in green but doesn't have any caption on top.

How to add missing caption on top of the picker?


You should provide a caption to each WKPickerItem:

let item1 = WKPickerItem()
item1.title = "10"
item1.caption = "CAPTION!"