How to Implement UIKeyInput

410 views Asked by At

I have a pickerView with multiple options in it. What I want is that when the user selects the "B" option in the pickerView, the pickerView goes away and the regular keyboard comes up so a user can input their own value into the textfield. I don't really understand how the UIKeyInput works though. For the pickerViews, I can just do something like var datePicker = UIDatePicker() and then later on dateTextField.inputView = datePicker It doesn't let me do this with a UIKeyInput though. When I do var customShutterSpeed = UIKeyInput() it gives me the error "'UIKeyInput' cannot be constructed because it has no accessible initializers" Is this not the right inputView to bring up the regular keyboard anyways? Also, in the pickerView didSelectRow I have the following code to determine if the user has picked the option that should bring up the keyboard:

if pickerShutterSpeed[row] == B {
    phoneNumberTextField.resignFirstResponder()
    phoneNumberTextField.inputView = customShutterSpeed
}

and at the top of the ViewController file I said var B:String = "B" This isn't working to determine if the "B" option was selected in the pickerView. BTW phoneNumberTextField is the textfield that the shutter speed options appear in I just have weird names for certain variables. Also I am not very good at swift as you can probably tell.

0

There are 0 answers