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

收入记录控制输入金额为12位

parent f275b13a
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
import UIKit import UIKit
class YHIncomeInputMoneyCell: YHResignDocumentCell { class YHIncomeInputMoneyCell: YHResignDocumentCell {
private let maxCount = 12
static let cellReuseIdentifier = "YHIncomeInputMoneyCell" static let cellReuseIdentifier = "YHIncomeInputMoneyCell"
...@@ -208,6 +209,11 @@ extension YHIncomeInputMoneyCell: UITextFieldDelegate { ...@@ -208,6 +209,11 @@ extension YHIncomeInputMoneyCell: UITextFieldDelegate {
if (string as NSString).rangeOfCharacter(from: number.inverted).location != NSNotFound { if (string as NSString).rangeOfCharacter(from: number.inverted).location != NSNotFound {
return false return false
} }
let count = (textField.text?.utf16.count ?? 0) - range.length + string.utf16.count
if count > maxCount {
return false
}
return true
} }
return true return true
} }
......
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