title: Attempt to dismiss UIPickerView via toolBar causing unexpected behavior
body: <p>I have a PickerView that updates with array data depending on which textField is selected. I attached a toolbar to this pickerView to allow for a "Done" button that would dismiss the picker. when tapped, however, the done button doesnt dismiss the picker, but instead resets the data in the picker to select the first option (it rolls it from the selected option,back to the first option in the array). The done button doesn't seem to actually fire the function I have designated. Im wondering if I have written the BarButtonItem incorrectly. For ease of troubleshooting, i changed the action of the done and cancel button to simply print to console, but that never happens for either button. Could someone take a look at my code and tell me why the "Done" and "Cancel" button arent connected to my functions.</p>
  
  <p>Ive had several errors pop up at that BarButtonItem, all seeming to have to do with the action: option. On each error I chose the recommended fix. Ive looked throughout this site and several others for tutorials, but those arent helping. Like I said, I believe I just have some syntax error in the action: part that isnt finding my functions</p>
  
  <pre><code>import UIKit
  
  class MiniRAEBuilderViewController: UIViewController, UIPickerViewDataSource, UIPickerViewDelegate, UITextFieldDelegate {
  
  // Create the textField outlets
  @IBOutlet weak var lampTextField: UITextField!
  @IBOutlet weak var battTextField: UITextField!
  @IBOutlet weak var wireTextField: UITextField!
  @IBOutlet weak var kitTextField: UITextField!
  
  // create the pickerView
  var pickerView = UIPickerView()
  
  override func viewDidLoad() {
      super.viewDidLoad()
      navigationItem.largeTitleDisplayMode = .never
      title = "\(modelName) Builder"
  
      // set textField's delegate and inputView
      lampTextField.delegate = self
      lampTextField.inputView = pickerView
      battTextField.delegate = self
      battTextField.inputView = pickerView
      wireTextField.delegate = self
      wireTextField.inputView = pickerView
      kitTextField.delegate = self
      kitTextField.inputView = pickerView
  
      // Set pickerView delegate and data source
      pickerView.delegate = self
      pickerView.dataSource = self
  
      // create the tool bar for the pickerview
      let toolBar = UIToolbar()
      toolBar.barStyle = UIBarStyle.default
      toolBar.isTranslucent = true
      toolBar.sizeToFit()
      // create the buttons for toolbar
      let doneButton = UIBarButtonItem(title: "Done", style: UIBarButtonItem.Style.plain, target: self, action: Selector(("doneButtonAction")))
      let spaceButton = UIBarButtonItem(barButtonSystemItem: UIBarButtonItem.SystemItem.flexibleSpace, target: nil, action: nil)
      let cancelButton = UIBarButtonItem(title: "Cancel", style: UIBarButtonItem.Style.plain, target: self, action: Selector(("cancelButtonAction")))
      // set the toolbar to the pickerView
      toolBar.setItems([cancelButton, spaceButton, doneButton], animated: false)
      toolBar.isUserInteractionEnabled = true
      pickerView.addSubview(toolBar)
  
  }
  
  // this should be the action taken when the done button on picker view toolbar is tapped
  @objc func doneButtonAction() {
      print("why oh why")
      self.view.endEditing(true)
  }
  
  // this should be the action taken when the cancel button on picker view toolbar is tapped
  @objc func cancelButtonAction() {
      print("this is cancel")
  }
  
  func textFieldDidBeginEditing(_ textField: UITextField) {
      self.pickerView.reloadAllComponents()
  }
  
  
  func numberOfComponents(in pickerView: UIPickerView) -&gt; Int {
      return 1
  }
  
  func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -&gt; Int {
  
  }
  
  func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -&gt; String? {
  
  }
  
  func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
  }
  </code></pre>
  
  <p>I am expecting the done button and cancel button to each print the print statement to the console, but instead they are just changing the selection from the one the user chose to the first option in the array.</p>