当我第一次加载它时,似乎无法在UIPickerView中选择第一行。加载选择器视图时,我希望文本字段立即更新。仅当我选择其他东西然后返回第一行时,它才会更新。
Private Sub CommandButton1_Click()
Dim Cell As Range, v1, v2
v1 = Array("2X4", "2X6", "2X6H"): v2 = Array(2, 2, 2)
With Sheets(2)
For Each Cell In .Range("AZ2:AZ" & .Cells(.Rows.Count, "AZ").End(xlUp).Row)
If Cell.Value = 1 Or Cell.Value = 2 Or Cell.Value = 3 Then
.Rows(Cell.Row).Copy Destination:=Sheets(v1(Cell.Value - 1)).Range("A" & v2(Cell.Value - 1))
v2(Cell.Value - 1) = v2(Cell.Value - 1) + 1
End If
Next Cell
End With
End Sub
答案 0 :(得分:1)
改善您的代码。
platformSelected.delegate = self
......
// MARK: - UITextFieldDelegate
extension YourUIViewController: UITextFieldDelegate {
func textFieldDidBeginEditing(_ textField: UITextField) {
// TODO: - Specify index what you need. After editing it changed and you should get selected index using its position in platformData Array
let index = 0
picker.selectRow(index, inComponent: 0, animated: true)
}
}