Commit fed21496 authored by David黄金龙's avatar David黄金龙

处理 一处 \n

parent a3888a78
...@@ -571,7 +571,7 @@ extension YHItemView: UITextFieldDelegate { ...@@ -571,7 +571,7 @@ extension YHItemView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if string.isEmpty == true { if string.isEmpty == true {
var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string) let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
var data = dataSource ?? YHItemModel() var data = dataSource ?? YHItemModel()
data.message = newText data.message = newText
if let block = block { if let block = block {
...@@ -580,6 +580,10 @@ extension YHItemView: UITextFieldDelegate { ...@@ -580,6 +580,10 @@ extension YHItemView: UITextFieldDelegate {
return true return true
} }
if string == "\n" {
return false
}
var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string) var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if (dataSource?.id == .id21 || dataSource?.id == .id22 || dataSource?.id == .id23) && newText.count > 30 { if (dataSource?.id == .id21 || dataSource?.id == .id22 || dataSource?.id == .id23) && newText.count > 30 {
return false return false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment