Hi there, I would like some help regarding the issues I have.
On the book, in the Dismissing the Keyboard part of the chapter, I followed the book’s instruction but when I tap the background of the view, it did not dismiss the keyboard. Can anyone help? Here’s my code.
import UIKit
class ConversionViewController: UIViewController {
@IBOutlet var celsiusLabel: UILabel!
@IBOutlet var textField: UITextField!
@IBAction func dismissKeyboard(_ sender: UITapGestureRecognizer) {
textField.resignFirstResponder()
}
@IBAction func fahrenheitFieldEditingChanged(_ textField: UITextField) {
if let text = textField.text, !text.isEmpty {
celsiusLabel.text = text
} else {
celsiusLabel.text = "???"
}
}
}
I am also uploading a file that shows the connection of the ConversionViewController respectively. Help would be appreciated.