Basically i want when the user press the phone number to popup the number keyboard and i set this in Storyboard same for the Name with a normal keyboard and the date picker will popup when the user wants to enter the date.
Yet what i get is this little popup in the bottom of my screen for the three fields. what did i do wrong ??? Only the date picker pop up works fine the other two fields give this picture in the bottom
My ViewdidLoad
class SignUp : BaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
renderButton()
fullName.delegate = self
birthDate.delegate = self
phoneNumber.delegate = self
}
My DatePicker for the date textfield
@objc func datePickerValueChanged(sender : UIDatePicker) {
let formatter = DateFormatter()
formatter.dateStyle = .medium
formatter.dateFormat = "yyyy-MM-dd"
formatter.timeStyle = .none
birthDate.text! = formatter.string(from: sender.date).formattedDate!
}
And the extensions of the UITEXTFIELD
extension SignUp : UITextFieldDelegate {
func textFieldDidBeginEditing(_ textField: UITextField) {
if textField == birthDate {
textField.layer.borderColor = UIColor.topaz.cgColor
} else if textField == fullName {
textField.layer.borderColor = UIColor.topaz.cgColor
} else if textField == phoneNumber {
textField.layer.borderColor = UIColor.topaz.cgColor
}
textField.becomeFirstResponder()
}
func textFieldDidEndEditing(_ textField : UITextField) {
if textField == birthDate {
textField.layer.borderColor = UIColor.clear.cgColor
} else if textField == fullName {
textField.layer.borderColor = UIColor.clear.cgColor
} else if textField == phoneNumber {
textField.layer.borderColor = UIColor.clear.cgColor
}
textField.resignFirstResponder()
}
}
in simulator go to Hardware > Keyboard > Toggle Software Keyboard, or you can use short cut