UITableViewCell

时间:2019-07-18 11:34:27

标签: ios swift uitableview uitextfield

我有一个使用自定义UITableView的{​​{1}}。单元格包含一个UITableViewCell。如下图所示。 enter image description here

每个TextField是在UITextField方法中配置的。例如。 cellForRowAtIndexPathtextContentType

keyboardType

尽管在编辑最后一个TextField(Re-Password)时,尽管func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "ReuseCellIdentifier", for: indexPath) as! FormTableViewCell let inputItem = inputItems[indexPath.row] cell.titleLabel.text = inputItem.title cell.inputTextField.placeholder = inputItem.placeholder cell.inputTextField.textContentType = inputItem.contentType cell.inputTextField.keyboardType = inputItem.keyboardType cell.inputTextField.isSecureTextEntry = inputItem.isSecure return cell } 设置为newPassword,但它仍将电子邮件地址显示为自动填充建议。

enter image description here

如果点击其中一项建议,则将使用电子邮件填充email(3rd textField)。而不是正在编辑的textField。第四文本字段(密码)也成为第一响应者。

enter image description here

奇怪的是,如果我删除此行,问题就消失了

textContentType

InputItem类,

cell.inputTextField.isSecureTextEntry = inputItem.isSecure

1 个答案:

答案 0 :(得分:0)

 // you can set autocorrectionType to turn on/off suggestions

 // UITextAutocorrectionType can be .no or .yes

 cell.inputTextField.autocorrectionType = inputItem.autocorrectionType // set .no to turn off suggestions 
相关问题