WKInterfacePicker 标题
WKInterfacePicker Caption
您知道如何向 watchOS 选择器添加静态字幕吗?标题看起来像这样,上面写着 Item 1.
我已经在 Interface Builder 中选择了合适的样式:
我的代码:
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
let item1 = WKPickerItem()
item1.title = "10"
let item2 = WKPickerItem()
item2.title = "20"
let item3 = WKPickerItem()
item3.title = "30"
picker.setItems([item1, item2, item3])
picker.focus()
}
我在模拟器中得到的结果:
如何在选择器顶部添加缺失的标题?
您应该为每个 WKPickerItem
:
提供一个标题
let item1 = WKPickerItem()
item1.title = "10"
item1.caption = "CAPTION!"
您知道如何向 watchOS 选择器添加静态字幕吗?标题看起来像这样,上面写着 Item 1.
我已经在 Interface Builder 中选择了合适的样式:
我的代码:
override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)
let item1 = WKPickerItem()
item1.title = "10"
let item2 = WKPickerItem()
item2.title = "20"
let item3 = WKPickerItem()
item3.title = "30"
picker.setItems([item1, item2, item3])
picker.focus()
}
我在模拟器中得到的结果:
如何在选择器顶部添加缺失的标题?
您应该为每个 WKPickerItem
:
let item1 = WKPickerItem()
item1.title = "10"
item1.caption = "CAPTION!"