Search code examples
iosswiftuipickerviewswift5

How to show keyboard when select specific row in pickerview


    var emailPickers:[String] = ["naver.com", "hanmail.net", "daum.net", "gmail.com", "nate.com", "input by myself"]

I want to: if picker's selected row index is 5 ("input by myself"), remove pickerview and show keyboard and can input textfield

please help me. Thank you


Solution

  • do the following steps this may helps you

    if you select the option "input by myself" from picker then

    yourTextField.resignFirstResponder()
    

    then update your text filed input view from picker view to nil

    yourTextField.inputView = nil
    

    then make your text field active again with becomeFirstResponder

    yourTextField.becomeFirstResponder()
    

    Hope this may helps you 😊