Commit e116314a authored by Alex朱枝文's avatar Alex朱枝文

赴港计划书 解决98个字符输入拼音 nihao没法选中‘你好’输入的问题

parent 4a480e08
...@@ -492,9 +492,13 @@ extension YHHKPlanItemView : UITextViewDelegate { ...@@ -492,9 +492,13 @@ extension YHHKPlanItemView : UITextViewDelegate {
if text.isEmpty { if text.isEmpty {
return true return true
} }
// 使用 NSString 来处理文本替换
let tempTxt = textView.text + text let nsString = textView.text as NSString
let newLength = calcTextLength(string: tempTxt) let newText = nsString.replacingCharacters(in: range, with: text)
let newLength = calcTextLength(string: newText)
// let tempTxt = textView.text + text
// let newLength = calcTextLength(string: tempTxt)
return newLength <= maxNumbler return newLength <= maxNumbler
} }
......
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