gpt4 book ai didi

ios - 从 WKPickerInterface 获取选中的索引

转载 作者:技术小花猫 更新时间:2023-10-29 11:22:54 27 4
gpt4 key购买 nike

我可以让WKInterfacePicker调用pickerDidSettle,但是我怎样才能得到选中项的索引呢?

@IBAction override func pickerDidSettle(picker: WKInterfacePicker) {
print("Picker settled to index: \(picker)")
}

最佳答案

Each time the picker value changes, the WKInterfacePicker object reports the change to its associated action method. The format of this action method is as follows:

OBJECTIVE-C

-(IBAction)pickerAction:(NSInteger)index

SWIFT @IBAction func pickerAction(index: Int)

You can use the action method’s index value to obtain the selected item from the array of items you used to configure the picker. The picker reports every change to its action method, regardless of how fast the user turns the Digital Crown. If your app should respond only to the item that the user selected, use the pickerDidSettle: method of WKInterfaceController to get the selected item instead.

Source Link

UPDATED SOURCE LINK

关于ios - 从 WKPickerInterface 获取选中的索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34982323/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com