Привет всем, Как я могу показать myPickerData2 после выбора «Cat» в моем pickerData? (как и где мне нужно поставить, если условие?) Большое спасибо!
import UIKit
class IlanVer_1_: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {
let myPickerData = [String](arrayLiteral: "Cat", "Dog")
let myPickerData2 = [String](arrayLiteral: "Abyssinian", "American Shorthair", "Ankara", "Ankara", "Bengal", "Birman", "Bombay", "British Shorthair", "Chinchilla", "Other") ```
func numberOfComponents(in pickerView: UIPickerView) -> Int {
return 1
}
func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
return myPickerData.count
}
func pickerView( _ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
return myPickerData[row]
}
func pickerView( _ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
cinsText.text = myPickerData[row]
}
@IBOutlet weak var cinsText: UITextField!
@IBOutlet weak var irkText: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
let thePicker = UIPickerView()
cinsText.inputView = thePicker
thePicker.delegate = self
}