0

I am new to swift. I have a viewController

enter image description here

Initially the pickerView is hidden but it appears on clicking on textField then it hides again. I want the button hide upon pickeriew selection and then unhide after selection. This is how i am doing it.

   func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
    pickerView.isHidden = false
    return false
}

I can hide the backButton like backButton.isHidden = true but it won't show when the selection is done.

Usama bin Attique
  • 337
  • 1
  • 3
  • 16

2 Answers2

2

Just make visible the back button when picker value is selected and hide the pickerview

func pickerView(pickerView: UIPickerView!, didSelectRow row: Int, 
inComponent component: Int)
{
backButton.isHidden = false
pickerView.isHidden = true
}
santhoshkumar
  • 191
  • 2
  • 10
0

If you want to to show the picker view during textfield selection, then you need to add picker view as textfield's input view. You can refer this link also https://blog.apoorvmote.com/uipickerview-as-inputview-to-uitextfield-in-swift/

Yogesh Mv
  • 1,041
  • 1
  • 6
  • 12