当我点击此屏幕上提到的UITextField
时,会出现一个小键盘键盘,问题是当我开始点击数字时,我的UITextField
不更新,只停留在没有数字的情况下placeholder
。当输入键盘按键时,UITextField不会更新
我需要做什么?
感谢
添加代码!
@IBOutlet weak var salarioTextField: UITextField!
override func viewDidLoad()
{
super.viewDidLoad()
updateView()
salarioTextField.delegate = self
}
func textFieldShouldBeginEditing(textField: UITextField) -> Bool
{
if textField == feriasTextField
{
feriasTextField.inputView = feriasPicker
}
else if textField == salarioTextField
{
salarioTextField.keyboardType = UIKeyboardType.NumberPad
}
else if textField == inicioTextField
{
textField.inputView = datePicker
textField.inputAccessoryView = toolbar
datePicker.date = inicioDate
}
else if textField == motivoTextField
{
motivoTextField.inputView = motivoPicker
}
else
{
textField.inputView = datePicker
textField.inputAccessoryView = toolbar
datePicker.date = fimDate
}
return true
}
func textFieldDidBeginEditing(textField: UITextField)
{
backgroundScrollView.scrollEnabled = true
let scrollSize = CGSizeMake(view.frame.width, view.frame.height)
backgroundScrollView.contentSize = scrollSize
activeTextField = textField
activeTextField?.becomeFirstResponder()
}
func textFieldDidEndEditing(textField: UITextField)
{
backgroundScrollView.contentSize = CGSizeMake(0, 800)
backgroundScrollView.scrollEnabled = true
}
请忽略其他UITextField
。
你为textField设置了一个委托吗? –
添加你到目前为止的代码 –
是的,我已经设置了委托。 –